Skip to content

mertdotdev/agentxray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agentxray

CI

DevTools for your AI agents — find out where your agent burns time, tokens and money.

Your coding agent worked for 20 minutes and you have no idea what happened in between. agentxray reads the session transcript and shows you: which tools ran, where they failed, where the agent got stuck in a loop, and what it all cost.

Pointed at 56 real Claude Code sessions — 2,992 tool calls across 9 projects over 20 days — here is what it found:

1 in 7 tool calls failed or was a repeat; 62.5% of sessions had a failed call; wall clock overstates agent time by 41x

Every number above is reproducible on your own machine with npx agentxray benchmark. Method, caveats and the full table: docs/BENCHMARK.md.

agentxray stats demo

Why

AI agents are black boxes. You give Claude Code a task, it runs hundreds of tool calls, and all you see is the final answer. When something goes wrong — a task that took 3× longer than it should, a bill that surprised you — the evidence is buried in a JSONL file nobody wants to read. agentxray is the window into that box, the way browser DevTools is a window into a webpage.

Install

npx agentxray stats <transcript.jsonl>

Usage

Claude Code stores session transcripts under ~/.claude/projects/. Point agentxray at one:

# The full breakdown: tokens, cost, tools, loop smells
agentxray stats ~/.claude/projects/my-project/session.jsonl

# Timeline: every message and tool call, in order
agentxray view ~/.claude/projects/my-project/session.jsonl

# Machine-readable
agentxray stats session.jsonl --json

Real output from a real session:

session  1375 events, 830 assistant turns
tokens
  output            999,728
  cache read    142,094,564
  cache hit           99.9%  (healthy)
  est. cost          $92.44
tools
  Bash                    114 calls 15 errors
  Edit                     57 calls
⚠ repeated calls (possible loops)
  8× within 10min  Bash: python -m pytest tests/ -q
  13× within 10min Edit: src/orchestrator/intent.py

That warning section is the point: the same test command running 8 times in 10 minutes means the agent was stuck. Now you know where.

What it detects

Signal What it means
Loop smells Identical tool call repeated 3+ times within 10 minutes. Spread-out repeats (normal iteration) don't flag.
Cache hit ratio Below ~50% means cold context — you're paying full price for tokens that could be cached.
Tool error rates A tool failing 30% of the time is where your agent's minutes go.
Cost estimate Per-model pricing, including cache read/write rates. Unknown models are reported, never guessed.

Supported formats

  • ✅ Claude Code session transcripts (~/.claude/projects/**/*.jsonl)
  • 🔜 LangChain, OpenAI agents, OTel GenAI — the adapter layer is format-agnostic; open an issue for the format you need

How it works

Transcripts are parsed into a normalized event model (streaming, tolerant of unknown line types — unparseable lines are counted and reported, never silently dropped). Everything downstream — stats, timeline, loop detection — only sees that model, so new formats are one adapter away.

Zero runtime dependencies. Your transcripts never leave your machine.

License

MIT

About

X-ray for your AI agents - see where your agent burns time, tokens and money

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors