A crash test for AI agents. CrossTrace records real runs of your agent, replays them with no API cost, and breaks one model call at a time the way providers and networks really break: a stream cut short, a stalled connection, a reset, a 429, an overloaded API. For every failure it tells you what your agent did . It runs in CI on every pull request.
Your agent needs no code changes and no SDK. It runs as it is, with its real SDK and framework code paths.
Warning: your tools really run. CrossTrace replays the model , not your code. During record , test and check , your agent runs for real, and so does every tool it calls in its own process or over a plain API: payments, emails, database writes, file changes. test runs your agent many times, with faults. Use test accounts, sandboxes and throwaway data only. Never live keys or real records. The one exception is tools behind the MCP wrapper : in test , those are answered from the recording unless you turn on real tools. In record they run for real too.
Warning: your tools really run. CrossTrace replays the model , not your code. During record , test and check , your agent runs for real, and so does every tool it calls in its own process or over a plain API: payments, emails, database writes, file changes. test runs your agent many times, with faults. Use test accounts, sandboxes and throwaway data only. Never live keys or real records. The one exception is tools behind the MCP wrapper : in test , those are answered from the recording unless you turn on real tools. In record they run for real too.
crosstrace-site.vercel.app : the short version, with an animated walkthrough.
What it finds in a stock LangGraph agent
A support agent written the way most LangGraph tutorials write one ( create_react_agent , streaming ChatOpenAI , default settings, three tools; source ), recorded once against a real model on OpenRouter, then tested offline:
The stream broke inside a tool call, and the agent acted on the broken value. The model asked for order 42. LangChain completed the half-received JSON, and get_order(order_id=4) really ran , with no error anywhere. A tracking number cut to "BD1234" ran too (2 of 3 cut calls). In the third, the arguments came out empty ( {} ), validation rejected them, the tool did not run and the model was told.
A stalled stream froze the agent. ChatOpenAI has no read timeout by default; the openai SDK waits up to 10 minutes per attempt. Setting ChatOpenAI(timeout=30) turns the hang into an error (SURFACED 5/5), but not into a recovery: the SDK's retries stop once response headers have arrived, so a mid-stream timeout is never retried.
A cut final answer was printed as the answer. "Your order 42" and "I'm sorry your mug arrived broken, Asha." with exit code 0, or nothing at all with exit code 0.
What it handled well: HTTP errors before the stream starts. The SDK's retries cover those.
Each finding comes with the fix for the SDK it detected, and the exact command that reruns that one trial.
These are not exotic faults. A clean cut without the final event is what a gateway produces when its upstream dies but it closes the response politely. The same behaviour shows up across SDKs: what the OpenAI, Anthropic and Vercel SDKs do under each fault .
What really ran, not what the model traffic says
Model traffic only shows what an agent said it called. For Python agents (3.12+), CrossTrace also records which tool functions actually executed, and with what values , with no change to your code: it watches the functions named like the tools your model was offered, in your own files only, using Python's sys.monitoring .
It compares each fault trial with two healthy replays. A tool that ran with values the healthy run never used is WRONG_ACTION ; a write that ran more often is DUPLICATE .
It blames the agent only for what ran before CrossTrace had to answer with a stand-in (the healthy one, for a request that was never recorded). Later runs may have been asked for by that , so they are listed in the report and not judged. With --live the real model replies, and everything counts. The same rule covers repeated MCP writes.
It judges only tools it saw run in the healthy replays, and skips any whose arguments change from run to run.
If your app routes a tool to a function with another name, map it: [tools] send_reply = "Mailer.deliver" .
Not observed: tools whose function has another name than the tool and is not mapped, tools living in installed packages or in another process (use the MCP wrapper for MCP servers), non-Python agents and Python 3.11. Then the verdict comes from model traffic alone and says so.
The same faults against other popular frameworks, each recorded once on a cheap real model and then replayed offline (recordings not published). Every row is what CrossTrace reported after its verdicts were corrected against what the framework really did.
More frameworks, and what each does when an MCP write's is lost (CrewAI runs a refund twice by default; the OpenAI Agents SDK, LangChain and Vercel AI SDK do with their retry options on): docs/failure-library.md .
The timeout fixes were run, not assumed (with 10 seconds). In the three streamed agents (LangGraph, the Agents SDK, pydantic-ai) a stall in the middle of a stream is raised, not retried. LlamaIndex and smolagents were run on 2026-11-20 against their latest releases (llama-index-core 0.14.26, smolagents 1.26.0), recorded twice on separate runs with the same results.
One command, one question
check writes the config if there is none, records one healthy run per input ( this calls your real model, with your key ), then replays it with only the cut-off and lost- faults and ends with a plain answer: did your agent do the wrong thing? Later runs reuse the recording, so they are offline: just crosstrace check . It says YES only for actions that were measured, and says so when execution could not be observed.
examples/broken_agents is a small agent on the official openai SDK whose failure handling can be switched between good and deliberately broken. Its recording (made against a local mock provider) is in the repo, so the test runs offline:
To reproduce the LangGraph results above, record the agent once with an OpenAI-compatible key (an OpenRouter key works as is, a few cents), then test:
A real model answers differently from run to run, so your recordings, and the exchanges a fault lands on, will differ from ours; the behaviour under each fault is what to compare.
Your agent must read its provider base URL from the environment, which the OpenAI and Anthropic SDKs, LangChain, LangGraph, LiteLLM, pydantic-ai and the Vercel AI SDK all do ( checked for each ). If yours uses its own variable, map it in crosstrace.toml : env = { MY_BASE_URL = "{proxy_url}/v1" } .
Commit crosstrace.toml and .crosstrace/recordings/ , and CI tests every pull request without API keys:
The report goes to the job summary. A nightly run tests every fault at every model call: examples/github/crosstrace.yml .
CrossTrace sits between your agent and the provider as a local proxy. It breaks one model call per trial, at the byte level, so your real SDK sees exactly what it would see in production. It then watches the agent's move : did it retry that call, stop with an error, or carry on as if nothing happened?
What can fail your build, and what cannot. A verdict fails the build only when it rests on something CrossTrace measured: a hang, too many or too fast retries, a retried request that can never succeed, a write that ran twice, an answer printed cut, or an agent that acted on a defective or carried on exactly as if nothing had happened. When an agent changes course in a way CrossTrace can only guess at, the result is a review with the facts shown (what it sent, how many messages), never a failure. Every result in the JSON report carries observed : the attempts, the status of the fault, and the agent's move.
The run continues past the fault. When an agent answers a failure with a request the recording does not contain (it re-prompts the model, summarises, rewrites its request), CrossTrace answers it with the healthy of the recorded plan instead of an error, so the run reaches its real end and the verdict comes from how it ended. A persistent fault ( "length_cut!persistent" ) keeps hitting the agent's recovery attempts too, which tests whether its recovery has a bound: an agent that keeps asking after 8 different requests is a RETRY_STORM . No model and no key are needed, so it stays deterministic and offline. It cannot tell whether a re-prompted agent would have received a good answer from a real model; it only shows that the agent stops. To check that too, add --live : those requests then go to the real provider with your own key ( OPENAI_API_KEY or ANTHROPIC_API_KEY , read from the environment, never stored or logged), at most 6 calls per trial ( --live-max-calls ), so a re-prompt is answered by a real model and the run ends on its merits. It spends money, so it is opt-in and meant for a handful of trials ( --fault , --path , --at ), not a whole run. Turn continuation off with --no-continue or [test] continue = false .
No LLM judge and no comparison of free-text answers: the verdict comes from which model call the agent made , so it is the same every time. Faults are injected at every model call of every recorded path (nightly) or a fixed sample (pull requests), so an agent can't pass by getting lucky on one run. Before any fault, each recording must replay exactly; if your prompts change on every run, CrossTrace names the field to mask instead of reporting a false pass.
Details: docs/cli.md . Fault list: crosstrace faults .
Early (v0.2). Tested end to end on the example agents here and the SDK matrix above; not yet on anyone else's production agent. If you try it on yours, an issue with what it found (or got wrong) is the most useful thing you can send.
Model calls: OpenAI chat completions and Responses, Anthropic Messages. Tool calls: MCP over stdio and streamable HTTP, see above.
Python 3.11+. Your agent can be in any language; it just has to be runnable as a command.
The healthy run must be repeatable enough to replay. Random values in prompts need a mask; heavy run-to-run variation in what your agent does needs several recorded runs.
Tool calls (MCP): a tool that ran but whose was lost
A model call that fails is annoying. A tool call that succeeded but whose response was lost can do damage: the email was sent, the card was charged, the form was submitted, the never reached the agent, and a retry does it a second time.
CrossTrace tests this for MCP servers over stdio and over streamable HTTP. For a stdio server, one change in your agent's MCP config: launch it as crosstrace mcp-wrap -- . For a remote server, list its URL in [mcp.http] and have the agent read its server address from CROSSTRACE_MCP_URL_ . The wrapper (or the local stand-in for the URL) records the tool calls in crosstrace record , and in crosstrace test it replays them without starting or calling the real server , so a replayed MCP call causes no side effect. This covers only tools behind the wrapper; your other tools still run, and --real-tools runs the MCP servers too. An agent with several servers names each one ( mcp-wrap --name github -- ... , or the key in [mcp.http] ).
lost_response : one tool call is made (and counted), and its is replaced by a transport error. Then we watch what the agent does.
Write counting: every call to a tool that changes something is logged. A write that was sent more often than in the healthy run is a DUPLICATE , in every trial, not only this one. A run that recovers and prints the right answer can still have written twice, so recovering is not enough to pass. This counts calls sent, not changes made: in replay no real server runs. The same check catches an agent that recovers from a model failure by starting the task over.
Which tools are writes: your [mcp] lists first, then what the server says itself (a tool it declares readOnlyHint is a read), then a guess from the name ( send , submit , pay , delete , click , ...; get , list , status are reads). List the ones it gets wrong in [mcp] writes / reads . For browser tools, click, type, fill_form, file_upload, press_key (Enter submits a form), evaluate and run_code are writes; navigate, snapshot and screenshot are reads. select_option and handle_dialog are ambiguous and count as reads: list them under writes if a choice or a confirmation can change something.
Runnable without any key: examples/mcp_agents ( pip install mcp openai ). Also checked by hand against the official @playwright/mcp 0.0.85 (25 tools): a scripted agent, a real Chrome and a local order form. Recording placed one real order; replays and trials placed none. Losing the response to the click made the retrying agent DUPLICATE in replay. With real tools, its second click was answered with an error (the button was gone) and only one new order was placed: UNCONFIRMED_DUPLICATE . The checking agent did not click again. That agent was scripted, so it tests the tool-call handling, not how well a model drives a browser. What this does not do yet:
Streamable HTTP is covered for what an agent sends as a POST (answered as JSON or an event stream). A server that pushes messages on its own GET stream is not: that stream gets a 405, which the protocol allows. Checked against the official Python SDK's server and client only. A lost response over HTTP is a 504 by default; with how = "drop" the connection is closed, which the official client turns into a crash of the whole session, so the agent cannot retry at all.
Several servers are handled by name. Each name must be used in both record and test ; two unnamed stdio servers are not told apart.
Your MCP client must start the wrapper with CROSSTRACE_MCP in its environment. The official Python SDK starts servers with a reduced environment, so pass it on (the example does).
Replay cannot answer a state check. An agent that asks a read tool "did it go through?" before retrying gets the recorded answer, or "not recorded", so it shows as stopping with an error, not as recovering safely.
A retry counts as a repeat unless the server declares the tool idempotent ( idempotentHint ) or the retry reuses the same idempotency key, sent as a top-level argument ( idempotency_key , request_id , client_token and similar). A retry with a new key counts as a repeat , because the server cannot know it is the same request. If a call has both an idempotency_key and a request_id , the idempotency key decides. A request_id or client_token is ignored when comparing two calls only if its value looks machine-made (a UUID, ULID or long hex string); otherwise it may name a record, so a different value is a different call. CrossTrace takes a reused key at its word: it cannot tell whether the server honours it. The official Playwright server declares readOnlyHint for 6 of its 25 tools and no idempotentHint .
The lost response is a transport error on a live session, not a dead server process.
Agents that call an API directly (REST, GraphQL)
Many agents call Shopify, Stripe or an ERP over plain HTTP instead of an MCP tool. Put crosstrace api-proxy in front of the API and point the agent's API base URL at it. Every request is forwarded and logged; for one write, the real API does the work and then the is lost (a 504, a dropped connection, no , or a late ). crosstrace api-report then says whether the agent sent it again and how many times the API accepted it. The writes really happen: use a sandbox or test account.
Options and verdicts: docs/cli.md .
CrossTrace started as research on tracing AI agents across the application and the kernel (eBPF): 21 stages, predictions written before each run. A look through real GitHub issues suggested that many agent failures are failure- handling bugs in SDKs and frameworks (no dataset or method is published here, so treat this as motivation, not a measurement), which is why the product tests failure handling. The research is in docs/research.md .
MIT licensed, see LICENSE .
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
