Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI Reference — Overview

The aasm binary (crate aa-cli) is the operator front-end for Agent Assembly. It talks to a running aa-gateway over its HTTP / OpenAPI surface (default http://localhost:8080) for registry, policy, audit, approval, cost, and topology operations, and manages local daemon processes (gateway, proxy, dashboard) directly.

Invocation

aasm [OPTIONS] <COMMAND> [SUBCOMMAND] [ARGS]

Every command supports --help (-h for a one-line summary) at each layer:

aasm --help               # list all top-level commands
aasm policy --help        # list policy subcommands
aasm policy apply --help  # flags + arguments for one subcommand

Global options

These flags are defined on the root parser (aa-cli/src/lib.rs) and are global — they may be passed before the command or on any subcommand.

FlagTypeDefaultDescription
--context <CONTEXT>string(default context, if any)Named context from ~/.aa/config.yaml to use for the API URL and key.
--output <OUTPUT>table | json | yamltableOutput format for list/get commands.
--api-url <API_URL>stringhttp://localhost:8080Override the gateway API base URL. Takes precedence over the resolved context.
--api-key <API_KEY>string(none)Override the API key. Takes precedence over the context’s stored key.
-h, --helpflagPrint help.
-V, --versionflagPrint the aasm version.

Several commands also expose a local --output or --json flag that overrides the global --output for that command only (e.g. aasm logs --output json, aasm status --json, aasm gateway status --json). These are called out on the relevant command pages.

Output formats

--output (source: aa-cli/src/output.rs) selects how list/get commands render:

  • table (default) — human-readable, colorized tables via comfy-table.
  • json — machine-readable pretty JSON.
  • yaml — machine-readable YAML.

Commands that stream (aasm logs --follow, aasm approvals watch), visualize (aasm trace, aasm topology tree), or open a TUI (aasm dashboard) ignore --output where it does not apply.

Config and context resolution

CLI configuration lives at ~/.aa/config.yaml (source: aa-cli/src/config.rs). It holds named contexts (connection profiles), an optional default context, and dashboard settings:

default_context: production
contexts:
  production:
    api_url: https://api.example.com
    api_key: prod-key
  staging:
    api_url: https://staging.example.com
dashboard:
  port: 3000
  auto_open: false

The active API URL and key are resolved with this precedence (highest first):

  1. Explicit --api-url / --api-key flags.
  2. The named context — --context <name>, otherwise default_context.
  3. Built-in default URL http://localhost:8080 (no key).

Manage contexts with the aasm context command group.

Note on paths. The CLI config file is ~/.aa/config.yaml. Separately, the locally-managed gateway uses ~/.aasm/ for its runtime artifacts — ~/.aasm/config.yaml (gateway config, see aasm start), ~/.aasm/policy.yaml, ~/.aasm/logs/gateway.log, and ~/.aasm/gateway.pid. These are distinct files.

Exit codes

aasm follows the standard convention:

  • 0 — success.
  • non-zero — failure. Common causes: the gateway is unreachable, the API returned a non-2xx status, a named context was not found, a file failed to parse, or a validation/simulation step found problems.

Some commands give the exit code a documented meaning so it can gate CI:

CommandNon-zero exit means
aasm statusGateway unreachable, any agent has violations, or storage health probe reports unavailable.
aasm policy simulateThe simulation detected policy violations.
aasm policy validate, aasm config validateThe file is invalid (error printed to stderr).
aasm audit verify-chainThe audit hash chain failed verification.

Command groups

CommandTalks toPurpose
aasm statusGateway HTTPFleet health, agents, approvals, budget at a glance.
aasm agentGateway HTTPList, inspect, suspend, resume, kill registered agents.
aasm policyGateway HTTP + localApply, version, diff, simulate, validate, show policies.
aasm topologyGateway HTTPVisualize agent trees, teams, lineage, stats.
aasm alertsGateway HTTPList, inspect, resolve governance alerts.
aasm approvalsGateway HTTP + WSHuman-in-the-loop approval queue.
aasm auditGateway HTTP + localQuery, export, verify, and compliance-export audit data.
aasm logsGateway HTTP + WSQuery and stream audit-log events.
aasm traceGateway HTTPVisualize a single session trace.
aasm costGateway HTTPCost summary and monthly forecast.
aasm dashboardGateway HTTP/WS + localTUI dashboard and embedded SPA server.
aasm gatewayLocal processManage the aa-gateway daemon.
aasm proxyLocal processManage the aa-proxy sidecar and its CA.
aasm start / aasm stopLocal processStart/stop the locally-managed gateway.
aasm sandboxLocalRun a WASM tool under the sandbox.
aasm configLocalValidate / boot an agent-assembly.toml.
aasm contextLocalManage ~/.aa/config.yaml contexts.
aasm adminGateway HTTPAdministrative operations (retention).
aasm versionGateway HTTPCLI + gateway/api versions.
aasm completionLocalGenerate shell completion scripts.

Developer-only commands. The source tree also defines aasm run (launch a governed AI dev tool) and aasm tools (discover installed AI dev tools). Both are gated behind the devtool region in aa-cli/src/commands/mod.rs and aa-cli/Cargo.toml and are stripped from the published crate by .ci/strip-for-publish.sh before release. They are intentionally not documented here because they are not part of the published aasm surface.


Last updated: 2026-06-11 by Chisanan232