CLI Reference¶
The agenttape command manages and inspects cassettes — all on local files, no network, no server.
agenttape <command> [args] [options]
agenttape --version
agenttape -v <command> ... # -v / --verbose: show full tracebacks
| Command | Does |
|---|---|
init |
Scaffold agenttape.toml + a cassettes/ directory |
record |
Run an entrypoint and record it |
replay |
Replay a cassette and print the reconstructed timeline |
inspect |
Pretty-print interactions, latency, tokens, cost |
timeline |
Render the run as an ASCII waterfall |
diff |
Structured diff of two cassettes |
redact |
Re-run redaction over a cassette |
validate |
Schema + determinism + leaked-secret lint |
export |
Export to JSON or OpenTelemetry |
view |
Generate a self-contained HTML viewer |
rm |
Delete a cassette and its assets |
Resolving cassette arguments
Most commands accept either a path (cassettes/x.yaml) or a bare name (x) — bare names are resolved against your configured cassette_dir.
init¶
Scaffold a project: writes a commented agenttape.toml (if absent) and creates the cassettes/ directory.
| Option | Default | Description |
|---|---|---|
--dir |
. |
Project directory to scaffold |
record¶
Import a module:function entrypoint and run it inside a recording session.
| Argument / Option | Default | Description |
|---|---|---|
entrypoint |
— | module:function to call (no args) |
cassette |
— | Cassette name to write |
--mode |
record |
Recording mode |
replay¶
Replay a cassette and print its reconstructed timeline. Confirms what would be served — no external calls are made.
inspect¶
Pretty-print a cassette: metadata, each interaction's request/response, and totals (latency, tokens, cost).
| Option | Description |
|---|---|
--full |
Don't truncate large payloads |
Cassette: cassettes/weather.yaml
version=1 run_id=de5dc0ac-…
meta: {"agenttape_version": "0.1.5", "mode": "record"}
freeze: clock, random, uuid
#0 [tool] get_weather (0.0ms)
request: {"name": "get_weather", "args": {"city": "London"}}
response: {"temp": 15, "condition": "rainy"}
------------------------------------------------------------
1 interactions · 0.0ms · 0+0=0 tokens · cost n/a
timeline¶
Render the run as an ASCII waterfall — great for seeing execution order and where time went.
Timeline: cassettes/weather.yaml
run de5dc0ac · 1 interactions
User
→ Tool get_weather |████████████████████████████████████████| 0.0ms
Done
Σ latency 0.0ms · tokens 0 · cost n/a
diff¶
Structured diff of two cassettes. Indispensable with Partial Replay for comparing a derived run against its original.
| Option | Choices | Default | Shows |
|---|---|---|---|
--type |
run, prompt, state, output, all |
run |
Which view of the diff to render |
redact¶
Re-apply your current agenttape.toml redaction rules to an existing cassette, in place. Use it after recording a cassette before a new rule was configured.
No --secret flag
redact applies the configured rules — it doesn't take an arbitrary secret string. Add the secret's pattern to [redact].regexes or its field name to [redact].denylist, then run redact. See Redaction.
validate¶
Lint a cassette: validate the schema, flag determinism risks, and scan for leaked secrets. Exit code is non-zero on errors — wire it into CI or a pre-commit hook.
export¶
Export a cassette to another format.
| Option | Choices | Default | Description |
|---|---|---|---|
--format |
json, otel |
json |
Output format (otel = OpenTelemetry trace) |
-o, --output |
— | stdout | Write to a file instead of stdout |
view¶
Generate a self-contained static HTML viewer — easier than reading long prompts in raw YAML. Pass a second cassette to render a side-by-side diff view.
| Argument / Option | Default | Description |
|---|---|---|
second |
— | Optional second cassette for a diff view |
-o, --output |
<cassette>.html |
Output HTML path |
rm¶
Delete a cassette and its sidecar assets (and any .derived companion).
| Option | Description |
|---|---|
-f, --force |
Skip the confirmation prompt |
Summary¶
initscaffolds;record/replaycapture and reconstruct.inspect,timeline,diff,viewhelp you understand a run.redactandvalidatekeep cassettes secret-free;exportfeeds observability tools.- All commands are local-only — no network, no server.