CLI reference
The axm Command
No arguments or root help prints the installed command catalog without loading
tool implementations. Version flags are recognized as the first argument and
print the installed axm version. Unknown commands exit with code 2:
the diagnostic goes to stderr and the catalog to stdout.
Available Commands
axm declares its launcher under project.scripts; it declares no tool
entry points itself. The current environment supplies the catalog through
axm.tools. Do not assume a fixed command count.
For example, after installing 'axm[init]':
Use each provider's help for its domain options. Standalone provider binaries are separate interfaces, not automatically subcommands of this launcher.
Parameters
Generated tool signatures come from execute (or a registered callable).
The adapter drops self, a parameter named kwargs and variadic
**kwargs. Keyword-only parameters are exposed as positional-or-keyword,
so the first parameter can usually be passed either positionally or by name.
Scalar Annotated[..., cyclopts.Parameter(...)] metadata is retained;
structured parameters are replaced by JSON-string annotations.
Non-scalar parameters
Lists, dicts, tuples, sets and other structured annotations, including
Pydantic models, use one JSON token on the command line. This also applies to
optional and Annotated wrappers. The wrapper decodes JSON; it does not
construct a Pydantic model, tuple or set from the decoded value. The tool owns
any required conversion and domain validation.
For the example tool:
A purely structured parameter with invalid JSON exits with code 2 before
execution. For a structured union that also admits str, including supported
recursive PEP 695 aliases, valid JSON is decoded and other tokens remain
literal text. Thus null, 123 or a quoted JSON string is decoded rather
than preserved verbatim.
Output modes
Generated tool commands use the following default rendering order:
- If the result failed and has a nonempty error, write it to stderr.
- If
textis a string, write it to stdout (even an empty string). - Otherwise, render a nonempty
datadictionary as JSON. - With no such data, print the result's string representation, except an error-only failure has already been reported on stderr.
The shared --json-output instead emits the data dictionary, including
{} when empty. It does not emit a success/data/error envelope.
Values unsupported by JSON serialization use their string representation.
Check the process exit status in addition to parsing the JSON.
If the tool declares its own json_output parameter, the wrapper neither
adds nor intercepts the shared option: the tool owns that flag's behavior.
The wrapper keeps its own failure diagnostics on stderr; it cannot prevent a provider from printing directly to stdout.
Exit statuses
| Status | Generated-tool behavior |
|---|---|
| 0 | Normal completion; also root catalog and version |
| 1 | success=False, an exception in execution, or generated-tool loading failure |
| 2 | Invalid command usage or invalid JSON for a structured parameter |
Legacy axm.commands entries are ignored, including when they share a name
with a tool. Migrate request–response commands to axm.tools; standalone
process lifecycle commands belong under project.scripts.
Python API
These launcher helpers live in axm.cli, outside the root SDK façade.
create_app() eagerly loads the catalog and is intended for introspection
and tests. The installed command uses the lazy main() path.
create_app()
Create an app with every installed AXMTool registered eagerly.
Intended for tests and introspection; main() dispatches lazily.
Source code in packages/axm/src/axm/cli.py
build_command_for_tool(tool_name, tool_obj)
Build a cyclopts command callable from an AXMTool (or plain callable).
The returned function carries the tool's typed __signature__ (non-scalar
params reshaped to JSON strings) and its docstring, runs execute /
the callable, prints result.text, and exits non-zero on failure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_name
|
str
|
The command name. |
required |
tool_obj
|
Any
|
The tool instance (or plain callable). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
A function suitable for |
Source code in packages/axm/src/axm/cli.py
| Python | |
|---|---|
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
Tool Interface
See the SDK reference for AXMTool, ToolResult,
metadata and the node adapter.
Validation Interface
See witnesses for their separate result contracts.