Skip to main content
AgentDbg stores every agent run as two plain files under ~/.agentdbg/runs/<run_id>/. These files are the public trace format (spec_version: "0.1") — a stable contract you can rely on for building tooling, writing scripts, or integrating with other systems. Nothing is sent to any server; everything lives on your machine as human-readable JSON.
All AgentDbg releases that share spec_version "0.1" use the same format. Additive changes (new optional fields, new event types) may be introduced without bumping the spec version. Breaking changes (removed fields, changed types) always result in a new spec_version.

Files per run

Each run lives in its own directory:
You can override the base directory with the AGENTDBG_DATA_DIR environment variable.

run.json

run.json is created when the run starts and updated when it finishes. It gives you a quick summary of the run without reading the full event log. Required fields: counts object:
Full example:

events.jsonl

events.jsonl is an append-only log where each line is a complete JSON event object. Events are written in the order they occur; when timestamps are identical, the file order is authoritative. AgentDbg flushes after every write so that crashes do not lose the final event.

Event envelope

Every event — regardless of type — has these top-level fields:

Event types


Payload schemas

RUN_START

  • run_name comes from AGENTDBG_RUN_NAME, the @trace("name") argument, or a default path:function - YYYY-MM-DD HH:MM label.
  • argv values matching configured redact keys are replaced with __REDACTED__ before being written.

RUN_END

status is either "ok" or "error".

LLM_CALL

  • prompt and response may be strings or objects. They may be redacted (__REDACTED__) or truncated (__TRUNCATED__) based on your configuration.
  • usage fields may be null if the provider did not return token counts.
  • When status is "error", the error field contains an object with error_type, message, and optionally stack and details.
  • provider is one of "openai", "anthropic", "local", or "unknown".

TOOL_CALL

  • args and result may be objects, strings, or null.
  • When status is "error", error has the same shape as in LLM_CALL.

STATE_UPDATE

  • state is the full snapshot; diff captures only what changed. diff may be null or omitted if not computed.

ERROR

  • error_type is the Python exception class name.
  • stack may be null if no traceback was available.
  • Guardrail aborts produce an ERROR event with additional fields:

LOOP_WARNING

  • Each distinct pattern triggers at most one LOOP_WARNING per run (deduplicated).
  • When stop_on_loop is enabled, LOOP_WARNING is written first, followed by an ERROR event and RUN_END(status="error").

Redaction and truncation

Before any payload is written to disk, AgentDbg applies redaction and truncation:
  • Redaction: Field values whose key matches a configured pattern (default: api_key, token, authorization, cookie, secret, password) are replaced with the string __REDACTED__. Redaction applies to RUN_START.argv option values and to all event payloads and meta objects.
  • Truncation: Fields that exceed the configured max_field_bytes limit (default 20000 bytes) are replaced with __TRUNCATED__.
Redaction is on by default. You can adjust which keys are redacted or disable redaction entirely via environment variables or config YAML. See the configuration reference.

Using the exported format

When you run agentdbg export, the output file wraps the same data in a single JSON object:
This makes it easy to load a run into any JSON-capable tool, share it with a teammate, or write scripts that process specific event types.