Docs de AgentLoom CLI reference

Esta documentación solo está disponible en inglés por el momento.

CLI reference

agentloom runs, checks, replays and resumes workflows. Every command, and agentloom itself, takes --help.

CommandWhat it does
runRuns a workflow.
validateChecks a workflow without running it, and prints its plan.
visualizeDraws a workflow’s DAG, as text or Mermaid.
replayRuns a workflow against a recording, offline.
verify-determinismReplays a recording several times and compares the results.
resumeContinues a run from its checkpoint.
runsLists saved checkpoints.
historyLists the record of every run.
callback-serverApproves and rejects paused runs over HTTP.
agent inspectPrints an agent’s definition as it loads.
infoPrints the version, dependencies and configured providers.

Common behaviour

  • agentloom --version prints the version, and -h is --help, on agentloom and on every command.
  • Warnings go to stderr, such as a retry or a parse warning. agentloom --log-level LEVEL COMMAND, or AGENTLOOM_LOG_LEVEL, shows more or less: see Logs.
  • Paths are checked: a workflow, agent or recording that doesn’t exist is a usage error, exit 2.
  • --json prints only JSON on stdout. Lines such as Running workflow: … go to stderr, and runs and history print [] when they find nothing. A command that stops before it has a result, such as on a workflow that doesn’t load, prints nothing on stdout and the error on stderr.
Exit codeWhen
0Success, a paused run, a valid workflow, or replays that agree.
1A run that failed, timed out or went over budget; a workflow, recording or config file that doesn’t load; a failed check.
2A usage error: an unknown option, a missing argument, a value out of range, a conflict between options, a --state without =.
130A run interrupted with Ctrl-C or, outside Windows, SIGTERM; with --checkpoint, it saves a checkpoint to resume.

Every run, replay and resume writes a record to agentloom_runs/<run_id>.json, or under AGENTLOOM_RUNS_DIR: see history.

run

Terminal window
agentloom run [OPTIONS] WORKFLOW_PATH
OptionWhat it does
-s, --state KEY=VALUESets a top-level state key, once per key. JSON-looking values, such as [1, 2], 5 or true, are parsed; others stay strings. See The initial state.
-p, --provider NAMESets config.provider: the provider tried first among those that serve the model, unless a config file sets up the providers. See Providers.
-m, --model NAMESets config.model. A step’s own model wins over it.
-b, --budget USDSets config.budget_usd.
--config FILEThe config file whose providers: block sets up the providers. By default, the file AGENTLOOM_CONFIG names, then ./agentloom.yaml.
--streamPrints model replies as they arrive. See Streaming.
--jsonPrints the whole result as JSON.
--checkpointSaves a checkpoint when the run ends, and prints its Run ID. See Checkpoints and resume.
--checkpoint-dir DIRWhere checkpoints go. .agentloom/checkpoints by default.
--mock-responses FILEAnswers from a recording with the mock provider; a step it lacks gets Mock response, with a warning.
--record FILERecords every provider call to FILE, for replay. An existing file is replaced.
--record-toolsWith --record, records the results of the model’s tool calls too.
--liteRuns without OpenTelemetry, even when the observability extra is installed.

The summary shows the status, duration, tokens and cost of the run and of each step and, with --checkpoint, the commands to resume a paused run. With --json, the result has status, step_results, final_state, total_tokens, total_cost_usd, error and run_id.

  • --record needs a live provider: it refuses a workflow with provider: mock, and --mock-responses. These conflicts exit with 2.
  • --mock-responses with a file that doesn’t exist is a usage error, exit 2.
  • A missing API key isn’t caught before the run: the first step fails with No provider registered for model …, after its retries.

validate

Terminal window
agentloom validate WORKFLOW_PATH

For examples/03_router_workflow.yaml:

Workflow 'customer-support-router' is valid.
Version: 1.0
Steps: 5
Layers: 3
Provider: openai
Model: gpt-4o-mini
Budget: $0.05
Execution plan:
Layer 0: classify
Layer 1: route
Layer 2: handle_billing, handle_general, handle_technical (parallel)

It loads the file as run does, agent files included, and checks every field, dependency, router target and subworkflow path, and that there is no cycle. Steps that can run in parallel and write the same output key get a warning. An error prints Validation FAILED: and exits with 1.

It doesn’t check what only a run finds: an inline subworkflow’s steps, a Pydantic schema’s import, tool names, prompt templates, keys or recordings. See What validate checks.

visualize

Terminal window
agentloom visualize [--format ascii|mermaid] WORKFLOW_PATH

ascii, the default, prints one row per layer, with a box per step, such as [IF/ELSE: route]. mermaid prints a Mermaid flowchart inside a ```mermaid fence, ready for a Markdown file. Both go to stdout.

Router edges in the Mermaid output carry the whole condition. For Graphviz DOT or PNML, use the Graph API.

replay

Terminal window
agentloom replay [OPTIONS] WORKFLOW_PATH --recording FILE

Runs a workflow against a recording made with run --record, without calling any provider. See Testing & replay.

OptionWhat it does
-r, --recording FILEThe recording. Required.
-s, --state KEY=VALUEAs in run.
-p, --provider NAME, -m, --model NAMEAs in run. A recording made with them replays with them, as its hashes cover the model.
--jsonAs in run; with a cut, it also lists each call and where it came from.
--allow-default-fallbackA step that the recording lacks gets Mock response, instead of failing.
--tools live|replay|verifyModel tool calls: live runs them (the default), replay serves the results recorded with --record-tools, and verify runs them and fails when a result differs. tool steps always run.
--live-from STEPRuns that step, and every step after it, against the live providers.
--force-live STEPRuns that step live, once per option.
--record FILEWith a cut, records this run to a new file.
--record-toolsWith --record, records tool results too.
--config FILEAs in run, for the live providers of a cut.
--observabilityTurns OpenTelemetry on, which replay leaves off.
  • Replay is strict. A step the recording lacks fails the run. A changed prompt fails too, for entries that carry a request_hash, as run --record writes them; older recordings without one replay a changed prompt with its recorded answer.
  • With --allow-default-fallback, a step in the recording gets its recorded answer, even if its prompt changed, with a warning.
  • A cut needs a provider and its key only for the steps that run live. Steps before the cut replay until a call misses, and go live from there; one that goes live on a model with no provider fails, naming the model.
  • Conflicting options, such as --record without a cut, and a --live-from or --force-live step the workflow doesn’t have, exit with 2.

verify-determinism

Terminal window
agentloom verify-determinism [OPTIONS] WORKFLOW_PATH --recording FILE

Replays the recording --runs times and compares the runs: the status, each step’s status, output and error, the final state and the event log. When the recording carries an event log, the replayed one must match it too.

OptionWhat it does
-r, --recording FILEThe recording. Required.
--runs NHow many replays, at least 2. 2 by default.
-s, --state KEY=VALUEAs in run.
-p, --provider NAME, -m, --model NAMEAs in replay: the provider and model the recording was made with.
--tools live|replay|verifyAs in replay. With live, tools run once per replay.
--events-out FILEWrites the first replay’s event log as JSON Lines.
--allow-failedAccepts replays that agree without succeeding.

It prints Deterministic: 2 replays of … give the same result and exits with 0, or prints the first difference as a diff and exits with 1. A replay that doesn’t end in success also exits with 1, unless you pass --allow-failed.

resume

Terminal window
agentloom resume [OPTIONS] RUN_ID

Continues a run from its checkpoint. Checkpoints and resume covers what runs again.

OptionWhat it does
--approve, --rejectThe decision for the paused approval gate.
--checkpoint-dir DIRWhere the checkpoint is. .agentloom/checkpoints by default.
-p, --provider NAME, -m, --model NAME, --config FILEAs in run.
-s, --state KEY=VALUESets a top-level state key over the checkpoint’s, parsed as in run. It is how the keys redacted from the checkpoint come back.
-b, --budget USDSets config.budget_usd, what the run has already spent included.
--stream, --json, --liteAs in run.
  • A run whose workflow says provider: mock resumes against its recording.
  • A value in --state is visible in the shell history and the process list, as any argument is.
  • --state reaches the run’s own state. A subworkflow paused at a gate resumes from its own checkpoint, and its redacted keys stay redacted.
  • An unknown run, or a decision for a run that isn’t paused, exits with 1. --approve with --reject exits with 2, and so does a subworkflow’s own checkpoint, <run id>.<step id>: the error names the run to resume.
  • A decision for a gate that expired is ignored, and resume says so: the gate takes its on_timeout.

runs

Terminal window
agentloom runs [--checkpoint-dir DIR] [--json]

Lists the checkpoints, with each run’s id, workflow, status and last update, in UTC, and when a paused run’s gate expires. Subworkflows have rows of their own, as <run_id>.<step_id>. --json prints the checkpoints whole, state and definition included.

history

Terminal window
agentloom history [OPTIONS]

Lists the record of every run that ended, checkpointed or not, newest first.

OptionWhat it does
--runs-dir DIRWhere the records are. AGENTLOOM_RUNS_DIR, else ./agentloom_runs.
--workflow NAMEOnly that workflow.
--provider NAMEOnly runs that used that provider, by name alone: anthropic, not anthropic/claude-….
--since DATE, --until DATEOnly runs from --since, and before --until. A date is midnight UTC, and a time without an offset is UTC too.
--min-cost USD, --max-cost USDOnly runs within that cost.
--limit NAt most N runs. 20 by default.
--jsonThe records whole.

A record holds the run’s id, time, workflow, a hash of its definition, status, the providers and models it used, cost, tokens, steps run, duration and error. Records are never deleted, and a resumed run replaces the record of its first part. A replay records the provider of the recording, not mock. Observability covers the record.

callback-server

Terminal window
agentloom callback-server [OPTIONS]

An HTTP server that resumes paused runs from their checkpoints, for approvals that come from another system.

OptionWhat it does
--host HOSTThe address to listen on. 0.0.0.0 by default.
--port PORTThe port. 8642 by default; 0 picks a free one.
--token TOKENA shared secret that requests must send in the X-AgentLoom-Token header.
--checkpoint-dir DIRWhere the checkpoints are. .agentloom/checkpoints by default.
--config FILEAs in run, for the runs it resumes. The server reads it when it starts, and stops if it doesn’t load.
--liteAs in run.
EndpointWhat it does
GET /pendingLists the paused runs, with expires_at for a gate that has timeout_seconds.
POST /approve/<run_id>Approves the run’s gate and resumes it.
POST /reject/<run_id>Rejects it and resumes it.
POST /webhookReceives an approval gate’s notification and prints it.
  • /approve and /reject answer 202 and then resume the run. The outcome reaches the checkpoint and the run’s record, not the caller. An unknown run answers 404, a run that isn’t paused 409, and a config file that stopped loading after the server started 500.
  • A decision for a run the server is already resuming answers 409.
  • A gate inside a subworkflow is decided on the run at the top. The child’s own run id, the one with a dot, answers 400 and names that run; a link whose ?gate=<path> isn’t where the run is paused answers 409.
  • A decision for a gate that expired answers 202 with expired_at: the gate takes its on_timeout.
  • The server resumes each run whose gate expired, without a request: it looks every 30 seconds, and at the next expiry it knows of.
  • With --token, every endpoint but /webhook answers 401 without the right header. A server on an address other than loopback, without a token, prints a warning: anyone who reaches it can decide. The token is a command-line argument, visible to other users of the machine in its process list.
  • Runs with provider: mock can’t resume here: the server sets up only live providers. Use agentloom resume.
  • A gate’s webhook can’t reach a server on localhost or a private address unless the workflow sets sandbox.allow_internal_webhook_targets: true. See The webhook.

agent inspect

Terminal window
agentloom agent inspect [--json] AGENT_PATH

Prints an agent’s definition as it loads, without running it: its model and prices, system prompt, tools with their parameters, the agents it calls, its loop policy, output schema and constraints. A file that isn’t a valid agent prints the errors and exits with 1.

info

Terminal window
agentloom info

Prints the AgentLoom version, the Python version and platform, the core dependencies and the observability extra, and the providers: OpenAI, Anthropic and Google as configured when their key is set, and Ollama’s address. It never prints a key.

What’s next

Docs de agentloom 0.5.0. Ver el código fuente de esta página Informar de un problema