Skip to main content

agentrace

ci license: MIT python

Observability for Claude Code subagents. Reads session transcripts, shows what your agents actually did, and flags the results you should not trust.

Demo

agentrace demo

Watch the demo

$ agentrace stats
 subagent runs          152
 errored                7
 total agent time       2.3 h
 slowest run            9.5 min
 prompt chars written   350,134
 result chars returned  257,721

$ agentrace check
 36/152 runs flagged, 39 findings

Why

Directing agents is the easy half. The hard half is knowing which of their answers to trust.

A model is good at producing candidates and bad at knowing what counts as proof. So when you fan out ten subagents and they each return a confident wall of text, the bottleneck is not generation, it is verification. And you cannot verify what you cannot see: by the time ten background agents have reported, the interesting details are buried in a transcript nobody reads.

agentrace reads the transcript for you.

No instrumentation, no wrapper, no SDK. Claude Code already writes every session to ~/.claude/projects/<slug>/<session-id>.jsonl, including every Agent delegation and its result. The data is on disk whether or not you planned ahead, so you can analyse the run you wish you had traced.

The checks come from real failures

Every check exists because it actually happened, over roughly 150 research subagents across two weeks. None of them are hypothetical.

Check The failure it came from
error Agents dying on session limits mid-sweep. Work silently lost; nobody noticed until the report was short.
absence_as_evidence An agent concluded a company was not hiring because an API returned an empty list. That API returns empty with HTTP 200 for accounts that do not exist. Absence of data is not evidence of absence.
gave_up "I was unable to find..." reads like an answer if you skim. It is not one.
hedged_claim An agent said a company "appears to be" hiring. That became a fact by the time it reached a decision. Hedges are honest; the bug is flattening them downstream.
unverified_urls Twenty URLs cited, none opened. That is autocomplete, not research.
no_output_contract / thin_prompt The failure that is yours, not the model's. A task with no definition of done cannot be verified, because you never really asked the question.
slow_run A subagent running 25 minutes is usually looping or retrying.

Run against the session that motivated the tool, it flags 36 of 152 runs: 7 agents that died on session limits, 17 hedged claims, and 12 prompts where I forgot to specify an output shape.

That last number is the useful one. Most agent tooling assumes the model is the problem.

These are hints, not verdicts

Every check is a heuristic over text. It tells you what to go read; it does not tell you what is true. Severity is deliberately conservative, and test_clean_run_produces_nothing exists to keep it that way: a checker that cries wolf gets switched off, which is worse than no checker at all.

That is not a slogan, it is maintenance. thin_prompt used to fire on any prompt under 200 characters. But "Run the suite and report every failing test as node ids with its assertion message" is 113 characters and completely verifiable, and flagging it taught nobody anything while spending the reader's attention. Length was never the defect. Being short and never saying what done looks like is, so now both signals have to fire. On the bundled fixture that took findings from 16 to 9 without losing a single true one.

Usage

agentrace list                  # every subagent run: description, duration, sizes
agentrace check                 # flag suspicious results
agentrace check --severity high # only the ones that definitely matter
agentrace check --strict        # exit 1 on any high finding (CI-friendly)
agentrace show 6e7fAJ8T         # read one run in full: prompt, result, findings
agentrace stats --json          # aggregate, machine-readable

Point it somewhere else with --dir or at one file with --file.

Install

pip install -e ".[dev]"
pytest -q          # 17 tests
agentrace stats    # reads ~/.claude/projects by default

No session of your own to look at yet? A synthetic one ships with the repo:

agentrace --file tests/fixtures/session.jsonl check

It is hand-written rather than a real transcript, deliberately: real sessions are full of whatever you were actually working on, and a fixture is not the place to publish it.

Zero dependencies beyond rich. No API keys, no network: it reads local files.

Design notes

Two passes over the transcript, not one. Results can appear before every use has been seen in unusual orderings. A 34MB file is cheap to scan twice compared to getting the pairing subtly wrong.

A torn final line is skipped, not fatal. A live session being appended to yields half-written JSON. Refusing to parse would mean you cannot analyse a run until it is over, which is exactly when you most want to look.

A run with no result still appears. An agent that is still going, or that died, should show up as such rather than vanish from the report.

Status

Working, 17 tests, validated against a real 34MB session with 152 subagent runs.

Release files for agentrace-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentrace-cli 0.1.0
File Size Uploaded
agentrace_cli-0.1.0.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentrace-cli 0.1.0
File Interpreter ABI Platform
agentrace_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / agentrace_cli-0.1.0.tar.gz

Download URL agentrace_cli-0.1.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a9e105e4636eb14662586c72ba634fa188303db9b01c28d0275871fbfdf58738
BLAKE2b-256 checksum
How to use checksums
81a86842c41ab886d9c421a43e0d210b8bd3608907e6f297af5be234e6b0800d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Release files / agentrace_cli-0.1.0-py3-none-any.whl

Download URL agentrace_cli-0.1.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb35e55eebc6f17bed3e9a7c6d5a4fdfe5e6f1eea814631ce1fbd4921cd2cb3f
BLAKE2b-256 checksum
How to use checksums
022cf6906f4cc2ca73504574922538b6c5bd5fa0f91b5d3e91877356891446dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page