Structured Tool API
AINL includes a simple structured tool interface for local agent loops:
Structured Tool API
AINL includes a simple structured tool interface for local agent loops:
- CLI:
ainl-tool-api - Schema:
tooling/ainl_tool_api.schema.json
Related docs:
../DOCS_INDEX.md(entrypoint map)../RUNTIME_COMPILER_CONTRACT.md(execution/strict contract)IR_SCHEMA.mdandGRAPH_SCHEMA.md(payload semantics)../CONFORMANCE.md(validation expectations)
Supported actions
compile-> returns IRvalidate-> returnsok,errors,metaemit-> returns selected artifact (ir|server|react|openapi|prisma|sql)explain_error-> returns a short remediation hintplan_delta-> comparesbase_irvs new program/IR and returns additive/replace actionspatch_apply-> safe patch merge (fail on conflict unlessallow_replace=true)policy_check-> validates auth/role/policy/contracts invariantscompat_check-> checks endpoint/type compatibility againstbase_irviability-> strict compile + gates + runtime boot/health/endpoint checksfeedback-> converts gate failures into normalized retry hints
Example
echo '{"action":"compile","code":"S core web /api"}' | ainl-tool-api
echo '{"action":"emit","target":"openapi","code":"S core web /api"}' | ainl-tool-api
echo '{"action":"plan_delta","base_ir":{},"code":"S core web /api"}' | ainl-tool-api
echo '{"action":"patch_apply","base_ir":{},"patch_code":"S core web /api","allow_replace":false}' | ainl-tool-api
CLI runtime options
When running AINL programs via python -m cli.main run, you can control adapter loading and configuration:
| Flag / Env | Description |
|------------|-------------|
| --config PATH | YAML configuration file. Enables LLM adapter registration and other adapter settings. |
| AINL_CONFIG | Env var alternative to --config. |
| --enable-adapter NAMESPACE.ADAPTER | Enable a specific adapter without a config file (rare). Multiple flags allowed. |
| AINL_ENABLED_ADAPTERS | Comma-separated adapter names to enable. |
Example:
export OPENROUTER_API_KEY="sk-or-..."
python -m cli.main run --config config.yaml examples/hello.ainl
See LLM_ADAPTER_USAGE.md for the config schema and environment variable details.
