CASE STUDYPython · SQLiteComplete

AgentTraceDAG

A time-travel debugger for LLM agents.

HEADLINE RESULTStep-levelcontext, payload and token replay
ANIMATED RESEARCH CONCEPT · NOT A PERFORMANCE FIGURE
ENGINEERING · AGENT OBSERVABILITY

The trace was flat because every chain node had disappeared

You cannot test a debugger on code that works. I built an agent designed to fail, pointed my own time-travel debugger at it, and found that the debugger was the thing with the bugs.

9
nodes in the scripted failing run
2
interceptor bugs fixed
25
tests passing after the fixes
9
recorded runs verified in the dashboard
01 · THE FIRST BUG HAD WINGS

The first bug had wings

In September 1947, operators of the Harvard Mark II computer, the team Grace Hopper worked with, traced a fault to a moth trapped in a relay. They taped it into the logbook with a note: first actual case of bug being found. The word was older than the moth, but the logbook made the point that has stuck ever since: debugging starts with a good record of what actually happened.

AgentTraceDAG is that logbook for LLM agents. It is a local time-travel debugger, in the spirit of browser developer tools: a FastAPI backend, a SQLite trace store and a DAG visualizer. You can scrub back through a run and inspect each step's context, tool payloads, latency and token use.

02 · TO TEST A DEBUGGER, BUILD SOMETHING BROKEN

To test a debugger, build something broken

A debugger is only as good as the failures it can show you. Real agents are a poor test bed: they need API keys and a network, and they rarely fail the same way twice. So I built a crash-test dummy, a scripted research agent with a fake model and no network. It deliberately fails a cite-check tool at step six, recovers, and records a nine-node trace with real parent-child nesting. Same run, same failure, every time.

The first surprise came before the agent ran at all. The debugger's own command-line entry point crashed on startup because of a missing import, while all 25 tests passed. It was a small fix and a useful warning about what the tests were not covering.

03 · A FAMILY TREE WITH NO PARENTS

A family tree with no parents

The first real run showed a deceptive failure. The dashboard worked, but the DAG was flat: every step sat at the same level, like a family tree where all the parents have vanished and everyone looks like siblings.

The cause was one assumption. LangChain can pass its serialized description of a component as None for a RunnableLambda. The interceptor assumed it was always a dictionary, so every chain node was silently dropped, and with them went the hierarchy. The repair added a name resolver that falls back to the name the callback supplies.

The fix was small. The dangerous part was that nothing errored. I now treat a missing trace event as a debugging failure, not as an acceptable gap in the picture.

9 NODES · NESTED
  1. research agent
  2. plan
  3. llm: outline
  4. gather
  5. tool: search
  6. tool: cite-checkfailed
  7. recover
  8. tool: cite-check
  9. llm: answer
chainllmtoolfailed step
Figure 1. The same scripted run before and after the fix. Before, every chain node was dropped, so the hierarchy vanished. Schematic: node labels are representative of the nine-node demo.
04 · A RECORDER THAT COULD NOT PLAY BACK

A recorder that could not play back

The second bug sat at the storage boundary, and it was the flight-recorder nightmare: a recorder that accepts the tape and then cannot play it back. Chain-end callbacks could emit outputs that were not dictionaries. SQLite stored them happily, but the Pydantic model rejected them when the trace was read back, which permanently broke node listing for that run.

Normalizing every value into a payload before storage made the trace schema durable across those callback shapes. The interceptor also backfilled model names from the LLM output, so each step in the inspector says which model ran instead of showing an anonymous box.

05 · THE BORING VERIFICATION THAT MATTERS

The boring verification that matters

After the fixes, the offline demo rendered nested nodes and showed the planned failure and recovery, and the test suite stayed at 25 passing tests. The dashboard was verified against nine recorded runs, with the DAG tree, node inspector and time scrubber all working.

The lesson is that observability code needs adversarial examples too. A trace that merely exists is not enough. It has to keep its hierarchy and stay readable after it has been stored, or it is a logbook with the pages glued shut.

06 · EXPLORE THE WORK