CLI reference
The agntz CLI ships inside @agntz/sdk. It creates YAML manifests, runs agents locally, publishes local state, and manages hosted runs, traces, and evals from the terminal.
For the first local workflow, start with CLI getting started.
Command map
| Command | Local? | Hosted? | Auth? | Purpose |
|---|---|---|---|---|
create | - | ✓ | No | Generate YAML from a description through the hosted builder. |
validate <path> | ✓ | - | No | Validate YAML, duplicate ids, and cross-file agent refs. |
run <path> | ✓ | - | No | Run a local YAML file or single-agent directory. |
run <id> | - | ✓ | Yes | Run a hosted agent by id. |
login / logout / whoami | - | ✓ | Mixed | Manage hosted API credentials. |
publish | ✓ | ✓ | Yes | Import local agents, sessions, and memrez memory into hosted storage. |
runs | - | ✓ | Yes | List, inspect, stream, or cancel hosted runs. |
traces | - | ✓ | Yes | List, inspect, or delete hosted traces. |
eval | - | ✓ | Yes | Run hosted evals and inspect eval runs or latest scores. |
Every command supports terminal help:
Auth and configuration
Hosted commands read credentials in this order:
AGNTZ_API_KEY~/.agntz/config.json, written byagntz login
API URL resolution uses:
- command
--urlwhere supported AGNTZ_API_URL- saved config
https://api.agntz.co
Local runs do not require an agntz API key. They use provider keys from your process environment, such as OPENAI_API_KEY, ANTHROPIC_API_KEY, or other keys required by the manifest's model/tool configuration.
create
Generates a YAML manifest by calling the hosted agent-builder. No login is required.
| Flag | Description |
|---|---|
-o, --output <path> | Write the manifest to a specific path. Default: ./agents/<id>.yaml. |
--stdout | Print YAML to stdout instead of writing a file. |
--current-manifest <path> | Revise an existing manifest instead of starting fresh. |
--url <apiUrl> | Override the builder API URL for this call. |
-h, --help | Show command help. |
Examples:
create validates that the builder returned YAML, parses the manifest to get its id, creates parent directories as needed, and prints the local run command to try next.
validate
Validates one YAML file or recursively scans a directory. The default path is ./agents; dependency, build-output, coverage, and hidden directories are ignored during recursion. Directory validation also rejects duplicate agent ids and unresolved pipeline, spawnable, or agent-as-tool references. The command exits with status 1 when any file fails or no agent manifests are found.
--json prints a complete machine-readable report, including per-file errors, warnings, and aggregate counts:
For editor completion, associate YAML files with https://agntz.co/schemas/agent-manifest.schema.json or use the packaged schema at @agntz/core/schema.
run
Runs an agent. The target determines local vs hosted mode unless you force a mode.
| Target shape | Mode |
|---|---|
./agents/support.yaml | Local YAML file |
agents/support.yml | Local YAML file |
./agents | Local directory, only if it contains exactly one manifest |
support | Hosted agent id |
| Flag | Description |
|---|---|
--input <text> | Input string. Use --input - to read stdin. |
--session <id> | Reuse a session id across calls. |
--stream | Stream reply/complete/error events instead of buffering the final output. |
--local | Force local execution. |
--remote | Force hosted execution. |
-h, --help | Show command help. |
Input resolution:
Examples:
Local runtime boundary: agntz run ./agents/support.yaml constructs a local SDK client with agntz({ agents: "<manifest-dir>" }). It can run agents whose requirements are satisfied by YAML plus environment configuration. If the agent declares local tools or resource providers that need application code, call @agntz/sdk from your service and pass tools / resources there.
login, logout, and whoami
login writes credentials to ~/.agntz/config.json with owner-only permissions. logout removes that file. whoami prints the resolved API URL and a masked key source.
Examples:
Browser-based login is not implemented in the current CLI. Paste an API key from the hosted or self-hosted dashboard.
publish
Migrates local manifests, persisted sessions, and memrez memory into hosted storage. Requires AGNTZ_API_KEY or agntz login.
Common options:
| Flag | Description |
|---|---|
--agents <dir> | Local agents directory. Default: ./agents. |
--db <path> | Local SDK SQLite store for sessions. |
--memory-db <path> | Local memrez SQLite store. Default: ./memory.db or ./memrez.db if present. |
--dry-run | Report what would be imported without writing hosted state. |
--include-superseded | Include superseded memory entries. |
Examples:
runs
Hosted run management. Requires AGNTZ_API_KEY or agntz login. Output is JSON.
Examples:
runs stream emits the multiplexed event stream for a hosted run subtree. --since <seq> resumes from a sequence number.
traces
Hosted trace management. Requires AGNTZ_API_KEY or agntz login.
Examples:
eval
Hosted eval management. Requires AGNTZ_API_KEY or agntz login.
Examples:
Current CLI boundary
The CLI covers manifest generation, recursive validation, local execution, hosted execution, state publishing, hosted run/trace inspection, and hosted eval execution. It does not provide project scaffolding, an interactive playground, or a Studio launcher. Use the SDK for application runtime wiring and the hosted app for managed agent editing.
Exit behavior
| Exit code | Meaning |
|---|---|
0 | Success |
1 | Argument, auth, network, builder, validation, or runtime error |
Most commands write human-readable errors to stderr. agntz validate --json and agntz publish --json provide structured CLI output; use @agntz/sdk for deeper local integration or @agntz/client for hosted execution.