strace for AI agents. Capture and replay every tool call, prompt, and response from Claude Code, Cursor, or any MCP client
# agent-trace
[](https://app.ona.com/#https://github.com/Siddhant-K-code/agent-trace)
[](https://pypi.org/project/agent-strace/)
[](https://pypi.org/project/agent-strace/)
[](LICENSE)
[](https://github.com/Siddhant-K-code/agent-trace/actions/workflows/test.yml)
`strace` for AI agents. Capture and replay every tool call, prompt, and response from Claude Code, Cursor, or any MCP client.

## Why
A coding agent rewrites 20 files in a background session. You get a pull request. You do not get the story. Which files did it read first? Why did it call the same tool three times? What failed before it found the fix?
Most tools trace LLM calls. That is one layer. The gap is everything around it: tool calls, file operations, decision points, error recovery, the actual commands the agent ran. `agent-strace` captures the full session and lets you replay it later. Export to Datadog, Honeycomb, New Relic, or Splunk when you need production observability.
## Install
```bash
# With uv (recommended)
uv tool install agent-strace
# Or with pip
pip install agent-strace
# Or run without installing
uvx agent-strace replay
```
**Zero dependencies.** Python 3.10+ standard library only.
## Quick start
### Option 1: Claude Code hooks (full session capture)
Captures everything: user prompts, assistant responses, and every tool call (Bash, Edit, Write, Read, Agent, Grep, Glob, WebFetch, WebSearch, all MCP tools).
```bash
agent-strace setup # prints hooks config JSON
agent-strace setup --global # for all projects
```
Add the output to `.cursor/settings.json`. Or paste it manually:
```json
{
"hooks": {
"UserPromptSubmit": [Agent that generates comprehensive documentation, API references, architecture diagrams, and developer onboarding guides from existing code.
Agent configuration for systematic bug investigation that traces issues from error logs through the codebase to root cause with suggested fixes.
Agent for integrating third-party APIs including SDK setup, type generation, error handling, retry logic, and rate limit management.
Cursor's built-in autonomous coding agent that can make multi-file edits, run terminal commands, search the codebase, and iteratively build features with minimal human intervention.
Cloud-based autonomous coding agent that runs in the background on remote sandboxed environments, handling complex multi-step tasks while you continue working.
Cursor's multi-file editing agent within Composer mode that can create, edit, and delete files across your entire project in a single conversation.