Monitor traces, metrics, and logs
Use local telemetry for turn history, Langfuse for distributed traces, Prometheus for monitoring, and the audit log for tool-call details. Start with a configured agent and choose the signals you need; these layers work independently.
Start with local evidence
Send one small test turn and inspect its row in Telemetry. Check the server log for startup or connection failures and the audit log for tool calls. These checks do not require Langfuse or Prometheus. If local evidence is healthy and you need cross-agent traces or time-series monitoring, configure the optional backends below and verify the same test turn reaches them.
Local telemetry store
Enabled by default, <instance_root>/telemetry.db stores turn outcomes, tokens, cost, duration, and model/tool-call counts, including coding-agent runs. telemetry.enabled: false disables this store; telemetry.db_path relocates it. History is pruned by telemetry.retention_days (default 90).
Use the operator token when querying a protected instance:
curl -H "Authorization: Bearer $PROTOAGENT_TOKEN" \
http://localhost:7870/api/telemetry/summary
curl -H "Authorization: Bearer $PROTOAGENT_TOKEN" \
'http://localhost:7870/api/telemetry/recent?limit=20'
curl -H "Authorization: Bearer $PROTOAGENT_TOKEN" \
http://localhost:7870/api/telemetry/insightssummary includes totals, success rate, latency percentiles, cache-hit ratio, and a per-model breakdown. insights flags outliers and possible savings; it never changes configuration. Its reasons identify the baseline used: latency compares like models or kinds of work, while cost compares priced turns. /api/telemetry/export downloads CSV.
Look up one run
Every delegation (a subagent, a background job, a workflow run and its steps, a coding agent, a peer agent) is recorded in <instance_root>/ledger.db with the run it belongs to and the delegation it was started from. A run is named by the A2A task id of the turn it started in. Work started outside a turn, such as a workflow run from Studio, is its own run, named by its first delegation.
curl -H "Authorization: Bearer $PROTOAGENT_TOKEN" \
http://localhost:7870/api/runs/<task-id>The response lists the run's delegations, oldest first, with edge_uuid and parent_uuid to rebuild the tree. It also lists the turns that ran inside the run, including a background job's own turn, and any delegations still in flight. You can also pass a workflow run id, a background job id or a coding-agent run's task id. The route finds the run that work belongs to and says so in resolved_from. So does the edge_uuid of any delegation inside a run, whether it has finished or is still running. Delegations recorded before this field existed have no run and don't appear.
Inspect a run in the console
The console draws the same record as a tree in the run drawer. You open it with a View run link, which you'll find in four places. In chat it sits next to View prompt under an assistant answer. On the Telemetry surface each row of the recent turns table has one. In the Background agents dialog each job row has a View run icon. The Org Chart plugin puts one on the history rows and live cards in its node drawer.
The top of the drawer shows the run id, the overall outcome, the total cost and how long the run took from its first start to its last end. When the run started from a subagent or workflow that the completion check looked at, the verdict and the number of nudges are shown too. A run that started from chat has no verdict of its own, since the check runs on subagents and not on the lead turn, so the header sums up the subagents it did check: how many passed, how many needed a nudge, and how many came back short. If you opened the drawer from a job, a workflow run or one delegation inside the run, it says which.
Below that, each delegation is one node in the tree, nested under the one that started it. A node shows what kind of work it was, its target and task, the outcome, the cost and the duration. A subagent's completion verdict is shown as a badge, and incomplete and partial are called out in the header. When a delegation failed, its error is shown on one line, and tapping it shows the full text. Expand a node to see the turns recorded for it, with the model, token counts and model and tool call counts, plus links to the trace and the exact prompts. A background job node also links to the job's report. Work still in flight shows a live dot and its latest progress, and the drawer refreshes every few seconds until nothing is running.
The tree supports the keyboard. The up and down arrows move between nodes, the right arrow expands a node or moves into it, the left arrow collapses it or moves to its parent, and Enter toggles it.
Copy link in the drawer copies a console URL ending in ?run=<id>. Opening that URL opens the drawer on the run, and the console then removes run from the address bar so a reload doesn't open it again. The id can be anything the route above resolves. If nothing was recorded under it, for example because the run is older than the retention window below, the drawer says so.
How long a run is kept
A run's parts live in different stores, and each one keeps its own window. A run's tree can outlive its full transcript.
| Part of a run | Store | Kept for | Setting |
|---|---|---|---|
| Full turn detail: messages, tool calls, the delegate reply timeline | a2a-tasks.db | Console chat- rows: until chat deletion (tombstone). Outside A2A threads eligible for From others: 7 days. job:, background:, system:, palette-: 24 hours. Windows use each row's last update; input/auth pauses and tasks spared for pending restart recovery are excluded from the sweep. | Fixed; lifecycle and deletion rules |
| Work tasks (including closed tasks, distinct from A2A turns) | tasks/issues.db | No automatic age pruning; kept until explicitly deleted. Closing a task keeps its record. | No retention setting |
| Inbox items | Inbox store | Delivered items: 90 days from creation. Pending items are never pruned. | inbox.retention_days (0 = keep forever) |
| Follow-up backoff deadline | Scheduler jobs.db, on the job generation | Persisted across restarts. An elapsed deadline remains recorded until cleared or the job is deleted; expiry alone does not delete it. Backoff clears when the origin chat stops waiting, the follow-up has news, or the job is edited. | Fixed hourly backoff; no retention setting |
| Turn outcome, tokens, cost, duration, trace link | telemetry.db | 90 days | telemetry.retention_days |
| Delegations and each run's tree | ledger.db | Forever | telemetry.ledger_retention_days |
| Workflow runs and their step output | workflows/.runs/*.json | The newest 200 finished runs. Running and paused runs are never pruned. | workflow_runs.max_runs |
| Background jobs and their results | Background job store | 90 days after the job finishes, once its result has been delivered. Running jobs and undelivered results are never pruned. Dismissing hides a job without deleting it. | background.retention_days |
| Activity feed entries | Activity store | 90 days | activity.retention_days |
| Prompt snapshots | prompt-snapshots.db | 30 days or 5000 calls, whichever comes first | prompts.retention_days, prompts.max_calls |
| Langfuse traces | Your Langfuse instance | Langfuse's own retention | In Langfuse |
Every console (desktop app, phone, browser) rebuilds a chat from the server's copy, so they show the same history. Each console also keeps a local copy, which is all that remains of chats the server swept before console chats were kept indefinitely (v0.235.x).
Count completion-check outcomes
A subagent with a completion contract (the review lanes, the verifier) is checked when it ends. If it stopped without its deliverable, it gets up to two nudges to finish. Each ledger row records the check's verdict in completion (complete, incomplete, or partial for a hard stop at max_turns) and the nudges it took in nudges. A lane can be outcome: ok and completion: incomplete: the dispatch worked, but what it returned wasn't the deliverable.
curl -H "Authorization: Bearer $PROTOAGENT_TOKEN" \
'http://localhost:7870/api/ledger/completion?days=7'For each subagent type it returns the runs checked, how many delivered, how many of those needed a nudge first (rescued), and how many ended incomplete or partial. Runs recorded before the verdict existed aren't counted.
Plugin numeric series from sdk.record_metric live separately in metrics.db. They remain enabled when turn telemetry is off because watches and other plugin features depend on their history. See the consumption SDK.
Langfuse (distributed traces)
In Settings → Tracing, enable Send traces to Langfuse, enter your host and key pair, then restart the agent. This also works in a fleet member's window. Keys are saved in untracked secrets.yaml. The non-secret config is:
tracing:
enabled: true
host: https://cloud.langfuse.comFor containers, supply the complete environment key pair and destination:
LANGFUSE_PUBLIC_KEY=pk_lf_...
LANGFUSE_SECRET_KEY=sk_lf_...
LANGFUSE_HOST=https://langfuse.your-domain.com| Credentials selected | Destination | Enablement |
|---|---|---|
| Complete environment key pair | LANGFUSE_HOST, otherwise http://host.docker.internal:3001 | Wins even over tracing.enabled: false |
| Config key pair | tracing.host, then LANGFUSE_HOST, then the same default | Requires tracing.enabled: true |
Environment keys never use the config's host. Specify a reachable destination; the default is intended for a local Docker deployment. Changes require a restart. Check the boot log for the selected layer and host, then send a test turn and look for its trace in that project.
What gets traced
- A2A turns use an
a2a-streamroot span, with model calls, tool calls, and subagent work nested beneath it. - Tool observations include arguments, a result preview, and duration.
- ACP coding-agent runs use
acp:<delegate>spans with the brief, reply or failure, plan, and tool spans.
Traces can contain conversation and tool content. Choose a destination suitable for that data; incognito turns suppress content while retaining timing and usage.
Coding-agent model calls (Claude Code)
When tracing is enabled, the Claude Code ACP integration sends native model-call spans through a loopback OTLP relay to the selected Langfuse project. The relay removes account identity attributes, redacts strings, maps token usage, and associates spans with the correct turn. The coder receives a relay URL, not Langfuse keys. Native prompt/tool-content logging flags are not enabled; the agent-level traces described above can still contain content.
If model-call spans do not arrive within the fallback window, the relay records the run's reported totals as a generation. Set PROTOAGENT_ACP_NATIVE_TRACING=0 to disable native coder tracing without disabling the agent's other traces.
Cross-agent trace propagation
A2A callers can include a2a.trace in params.metadata:
{
"a2a.trace": {
"traceId": "0123456789abcdef0123456789abcdef",
"spanId": "0123456789abcdef"
}
}Valid 32-hex trace IDs join the caller's trace; valid 16-hex span IDs select its parent span. Invalid trace IDs start fresh traces; invalid span IDs are ignored. The caller IDs are also recorded as metadata for correlation.

If Langfuse isn't configured
The agent continues without external traces. Authenticated GET /api/telemetry/recent reports tracing_enabled: false; the console's Trace column shows off. Check credentials, destination, and boot logs if tracing was intended to be enabled.
Prometheus metrics
Scrape /metrics on the agent's port. A token-protected agent also protects metrics, unless PROTOAGENT_PUBLIC_METRICS=1 explicitly makes them public. Keep metrics on the monitoring network. Example Prometheus authorization configuration:
scrape_configs:
- job_name: my-agent
authorization:
type: Bearer
credentials_file: /etc/prometheus/secrets/protoagent-token
static_configs:
- targets: ['my-agent:7870']Mount the token file in the Prometheus container and make the target resolvable from that container. Core metric names use a sanitized AGENT_NAME prefix (default protoagent). Useful series include *_llm_calls_total, *_llm_latency_seconds, *_llm_tokens_total, *_llm_cost_usd_total, *_tool_calls_total, and *_active_sessions. Inspect /metrics for the full set and labels. Cost and cache usage depend on the model endpoint's reporting.
If prometheus-client isn't installed
/metrics reports that metrics are disabled; the rest of the agent still runs.
Fleet trace export (the flywheel Observe)
Fleet trace export writes conversation trajectories for downstream analysis or training-data collection. It is off by default. Enable it per instance in Settings → Telemetry → Fleet trace export, or in config:
telemetry:
fleet_trace_export: truePROTOAGENT_FLEET_TRACE_EXPORT overrides the toggle: 1 enables, 0 disables, and a directory path enables export at that path. The default is <instance_root>/fleet-traces/fleet-traces-YYYYMMDD.jsonl.
Each row contains messages, tool calls/results and schemas, terminal outcome, trace/session IDs, model, cost, and duration. Writes are best-effort and incognito threads are excluded. These files contain raw conversation content.
Shipping to a shared dataset (redaction)
The repository's collection scripts are lab deployment helpers; inspect their paths and destinations before using them:
scripts/setup_fleet_tracing.shschedules transfer of raw dumps over SSH to a private collector (avaby default). Redaction happens on the collector, so raw data leaves the originating machine.scripts/sync_fleet_traces.shredacts on the collector before copying into the dataset directory. By default it refuses to copy when the redactor is unavailable.FLEET_REDACT=0explicitly bypasses that protection.
The redactor combines secret patterns with a privacy model; output filenames include the instance name. Review both the collected content and destination access before allowing a rig to contribute.
The helpers scan a box-style */fleet-traces layout and use their own PROTOAGENT_HOME convention. Do not assume they discover desktop app data, explicit instance roots, or Docker volumes automatically. For collector-side extra directories, set FLEET_TRACES_EXTRA_SOURCES; confirm discovered paths against protoagent config explain.
Audit log
Tool calls handled by audit middleware append to <instance_root>/audit/audit.jsonl (/sandbox/audit/audit.jsonl in the bundled container). Rows include timestamp, session, tool, arguments, result summary, duration, success, and trace ID for correlation with Langfuse.
Persist the entire /sandbox volume in Docker, including config and stores; mounting only the audit directory does not preserve the agent's state. Audit arguments and results can contain sensitive content.
Forensic replay
Filter failed tool calls from the Docker example:
docker compose exec -T agent cat /sandbox/audit/audit.jsonl \
| jq 'select(.success == false) | {ts, tool, result_summary}'This inspects recorded results; it does not re-execute tools.
Container logs
Logs go to standard error at INFO by default. Use docker compose logs agent or docker logs <container> to inspect boot, delivery, and tool errors. Set LOG_LEVEL=DEBUG for more detail or LOG_FORMAT=json for structured collection, then recreate the container with the updated environment.