Metadata-Version: 2.4
Name: crosstrace
Version: 0.2.0
Summary: Find the failures your AI agent hides: replay real runs with byte-level provider faults and get a verdict for each
Author: Mayank Kumar Singh
License: MIT
Project-URL: Homepage, https://crosstrace-site.vercel.app/
Project-URL: Repository, https://github.com/mac146/crosstrace
Project-URL: Issues, https://github.com/mac146/crosstrace/issues
Project-URL: Documentation, https://github.com/mac146/crosstrace/blob/main/docs/cli.md
Keywords: ai-agents,testing,fault-injection,resilience,llm,mcp,ci
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Provides-Extra: mcp
Requires-Dist: mcp>=2; extra == "mcp"
Requires-Dist: openai; extra == "mcp"
Provides-Extra: research
Requires-Dist: opentelemetry-sdk==1.45.2; extra == "research"
Dynamic: license-file

# CrossTrace

**A crash test for AI agents.** CrossTrace records real runs of your agent, replays them offline 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 rate limit, an overloaded API, a
reply cut at the token limit. For every failure it tells you what your agent did next, and the fix for the SDK it detected. It runs in CI.

Your agent needs no code changes. It only has to read its provider base URL from the environment (the OpenAI and Anthropic SDKs, LangChain,
LangGraph, LiteLLM, pydantic-ai, the OpenAI Agents SDK and the Vercel AI SDK all do).

```bash
pip install crosstrace
crosstrace init --command "python agent.py {input}"
crosstrace record     # runs your agent for real, once per input (uses your API key)
crosstrace test       # replays with faults, offline; exit code 1 if your agent hides a failure
```

Or ask one question with one command: does your agent do the wrong thing when a reply is cut off or lost?

```bash
crosstrace check -- python agent.py "{input}"
```

For Python 3.12+ agents it records which tool functions really ran, and with what values, with no change to your code. A tool that ran with
values the healthy run never used is `WRONG_ACTION`.

What it found in a stock LangGraph agent: a stream cut inside a tool call made it run the tool on the truncated arguments, in 2 of 3 cut
calls (the model asked for order 42, the agent looked up order 4, no error); a stalled stream froze it; a cut answer was printed as the whole answer.

It also tests MCP tool calls over stdio: when a tool succeeded but its response was lost, a retry can repeat a write (a second email, a second
form submit). CrossTrace counts writes after recovery and reports `DUPLICATE`.

Early (v0.1), open source (MIT).

- Source, full README and examples: https://github.com/mac146/crosstrace
- Short version with an animated walkthrough: https://crosstrace-site.vercel.app/
- Command reference: https://github.com/mac146/crosstrace/blob/main/docs/cli.md
- Issues: https://github.com/mac146/crosstrace/issues
