Metadata-Version: 2.5
Name: agent-strace
Version: 0.127.1
Summary: strace for AI agents. Capture and replay every tool call, LLM request, and decision point.
Project-URL: Homepage, https://github.com/Siddhant-K-code/agent-trace
Project-URL: Repository, https://github.com/Siddhant-K-code/agent-trace
Project-URL: Issues, https://github.com/Siddhant-K-code/agent-trace/issues
Project-URL: Documentation, https://github.com/Siddhant-K-code/agent-trace#readme
Author-email: Siddhant Khare <siddhantkhare2694@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,llm,mcp,observability,tool-calls,tracing
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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.10
Provides-Extra: all-integrations
Requires-Dist: anthropic>=0.20.0; extra == 'all-integrations'
Requires-Dist: crewai>=0.28.0; extra == 'all-integrations'
Requires-Dist: langchain-core>=0.1.0; extra == 'all-integrations'
Requires-Dist: litellm>=1.0.0; extra == 'all-integrations'
Requires-Dist: openai-agents>=0.0.1; extra == 'all-integrations'
Requires-Dist: openai>=1.0.0; extra == 'all-integrations'
Requires-Dist: strands-agents>=0.1.0; extra == 'all-integrations'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.20.0; extra == 'anthropic'
Provides-Extra: crewai
Requires-Dist: crewai>=0.28.0; extra == 'crewai'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1.0; extra == 'langchain'
Provides-Extra: litellm
Requires-Dist: litellm>=1.0.0; extra == 'litellm'
Provides-Extra: oidc
Requires-Dist: authlib>=1.3.0; extra == 'oidc'
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == 'openai'
Provides-Extra: openai-agents
Requires-Dist: openai-agents>=0.0.1; extra == 'openai-agents'
Provides-Extra: pdf
Requires-Dist: reportlab>=4.0.4; extra == 'pdf'
Provides-Extra: strands
Requires-Dist: strands-agents>=0.1.0; extra == 'strands'
Description-Content-Type: text/markdown

# agent-trace

[![PyPI](https://img.shields.io/pypi/v/agent-strace)](https://pypi.org/project/agent-strace/)
[![Python](https://img.shields.io/pypi/pyversions/agent-strace)](https://pypi.org/project/agent-strace/)
[![CI](https://github.com/Siddhant-K-code/agent-trace/actions/workflows/test.yml/badge.svg)](https://github.com/Siddhant-K-code/agent-trace/actions/workflows/test.yml)
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-agent--trace%20eval-blue?logo=github)](https://github.com/marketplace/actions/agent-trace-eval)
[![Open VSX](https://img.shields.io/open-vsx/v/Siddhant-K-code/agent-strace)](https://open-vsx.org/extension/Siddhant-K-code/agent-strace)
[![VS Marketplace](https://img.shields.io/badge/VS%20Marketplace-v0.3.0-blue?logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=Siddhant-K-code.agent-strace)
[![License](https://img.shields.io/github/license/Siddhant-K-code/agent-trace)](LICENSE)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/agent-strace?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/agent-strace)

**Before you merge an agent's pull request, see what its session did and did not prove.**
<p>Used by Meta, ByteDance, Zama.ai &amp; more<br><br><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/logos/meta-dark.svg"><img src="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/logos/meta.svg" alt="Meta" height="26"></picture>&emsp;&emsp;&emsp;<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/logos/bytedance-dark.svg"><img src="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/logos/bytedance.svg" alt="ByteDance" height="24"></picture>&emsp;&emsp;&emsp;<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/logos/zama-dark.svg"><img src="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/logos/zama.svg" alt="Zama" height="18"></picture></p>

`agent-strace` records a coding agent's session as local files, then reads that recording for the pull request.

<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/readme/how-it-works-dark.svg"><img src="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/readme/how-it-works.svg" alt="How it works: one recording, read three ways. Hooks save the agent's session as local files in .agent-traces/, with secrets redacted. Each command reads that recording, with no LLM: review posts findings on the pull request, share writes one HTML file that needs no server, and cognitive-debt shows what merged without review, keeping reviewed, not reviewed, and unknown lines apart."></picture>

- [`review`](docs/review.md) posts findings on the pull request.
- [`share`](docs/commands.md#share) writes a privacy-minimized evidence packet for the reviewer.
- [`cognitive-debt`](docs/cognitive-debt.md) shows how much agent-written code merged without review.

> [!WARNING]
> Experimental. Do not treat it as a production security boundary without your own threat model, controls, and testing.

## Quick start

```bash
uv tool install agent-strace
agent-strace setup --cli copilot   # or claude, codex, gemini, cursor
```

Restart the agent and do one task on a branch. Then:

```bash
agent-strace replay   # the latest session, in order
agent-strace health   # what the capture recorded and what it missed
agent-strace review   # findings for this branch
```

For Claude Code, `setup` prints the hooks to merge into `~/.claude/settings.json`. A [plugin](#agents) installs the hooks instead: use one or the other, not both.

<details>
<summary><a id="install-with-your-coding-agent"></a>Or let your coding agent install it</summary>

Paste this into Claude Code, Copilot CLI, Codex, Gemini CLI, or Cursor; it lists the commands before running them:

```text
Set up agent-strace (https://github.com/Siddhant-K-code/agent-trace) to record this coding agent's sessions as local traces. First, say which agent you are and list the commands you'll run. Never use sudo or hand-edit config files; if a step fails, stop and show me the error. 1. Install or upgrade the CLI: `uv tool install --upgrade agent-strace` (no uv: use pipx). If `agent-strace --version` fails, run `uv tool update-shell` (or `pipx ensurepath`), since the hooks call it from PATH. 2. Connect only this agent's capture path: Claude Code: `claude plugin marketplace add Siddhant-K-code/agent-trace`, then `claude plugin install agent-strace@agent-trace`. Copilot CLI: `copilot plugin marketplace add Siddhant-K-code/agent-trace`, then `copilot plugin install agent-strace@agent-trace`. Codex: `codex plugin marketplace add Siddhant-K-code/agent-trace`, then `codex plugin add agent-strace@agent-trace`. Gemini CLI: `agent-strace setup --cli gemini`. Cursor: `agent-strace setup --cli cursor`. Other agents: stop and point me to the agent-trace docs/setup.md guide. 3. Tell me to restart this agent from a new terminal (in Codex, trust the agent-strace hooks in /hooks), do one task, then run `agent-strace replay` and `agent-strace health`. Traces stay local in .agent-traces/; `agent-strace telemetry disable` turns off anonymous telemetry.
```

</details>

<details>
<summary>See it on a real session</summary>

<img src="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/demo.svg" alt="Terminal output of agent-strace replay, health and review on a real GitHub Copilot CLI session that fixes a small bug: replay lists the prompt, tool calls and results; health reports the evidence status and the provider's capture gaps; review reports rationale, scope, validation, stewardship and evidence health for the branch.">

</details>

## On the pull request

<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/readme/review-comment-dark.svg"><img src="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/readme/review-comment.svg" alt="Five findings, posted on the pull request: the comment on the demo pull request, trimmed. A GitHub Copilot CLI session with 7 tool calls, recorded by agent-strace hooks. Rationale: present, high confidence, 1 prompt captured. Scope: present, medium, all 4 written files were named in a prompt or read. Validation: present, medium, unittest passed in the session. Stewardship: partial, medium, 1 human turn and no approval decisions. Evidence health: partial, high, redaction on, linked by branch. Check: pass; by default it fails on missing at medium or higher confidence."></picture>

The GitHub Action posts this comment (from a [demo pull request](https://github.com/Siddhant-K-code/agent-trace-demo/pull/1)) and uploads the evidence packet as an artifact. It reads `.agent-traces/`, so the branch has to carry the traces.

```yaml
on: pull_request

permissions:
  contents: read
  pull-requests: write

jobs:
  reviewability:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - uses: Siddhant-K-code/agent-trace@v0.127.1
        with:
          run-eval: "false"
          review: "true"
          cognitive-debt: report
          post-pr-comment: "true"
          github-token: ${{ secrets.GITHUB_TOKEN }}
```

No CI? Paste `agent-strace review --format markdown` into the pull request body. That is the author's own claim, so the Action is the stronger path. See the [pull request evidence workflow](docs/ai-agent-pr-evidence.md) and the [Action reference](docs/review.md#github-action).

## What review checks

<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/readme/review-checks-dark.svg"><img src="https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/main/assets/readme/review-checks.svg" alt="It checks the session, not the code. What review looks for: rationale, the prompt that asked for the change; scope, files written versus files asked for or read; validation, tests and checks run in the session; stewardship, human turns and approvals; evidence health, capture gaps, redaction, and the session link. What it can't tell you: CI results, which it does not read; whether the code is right; what the hooks did not record, which is reported as a gap; and which session it was, if the session is linked by time only. Each finding is present, partial, missing, or inconclusive, with low, medium, or high confidence."></picture>

With no linked session, every finding is `inconclusive` at `low` confidence. By default the check fails only on `missing` at `medium` confidence or higher ([threshold](docs/review.md#threshold)). A session picked by commit time, or as the latest one, is a [weak link](docs/review.md#how-sessions-are-linked). [How to read the findings](docs/review.md#findings).

## Share and team view

```bash
agent-strace share --dry-run   # what it would disclose; writes nothing
agent-strace share             # writes session-<id>.html
agent-strace cognitive-debt --since 30d --by repository
```

The packet leaves out prompts, responses, commands, paths, and tool values unless you pass `--include-content`. Do not commit it. See the [disclosure preview](docs/share-disclosure-preview.md).

`cognitive-debt` keeps reviewed, unreviewed, and unknown lines apart; unknown never counts as reviewed. It is a workflow metric, not a code quality score. See [cognitive debt](docs/cognitive-debt.md).

## Agents

| Agent | What its hooks record |
|---|---|
| Claude Code | Prompts, the final response, tool calls, failed tools. No model or tokens. |
| OpenAI Codex | Prompts, responses, tool calls; tokens from 0.164.0. A failed shell command is a result. |
| GitHub Copilot CLI | Prompts and tool calls. No response text, model, or tokens. |
| Copilot cloud agent | Partial and unverified, only through a [collector](docs/copilot-cloud-agent.md). |
| Gemini CLI, Cursor | Hooks via [setup](docs/setup.md); not in the capture matrix yet. |

Details: [capture matrix](docs/capture-matrix.md). Plugins install the hooks plus a skill that runs `review` before a pull request opens:

```bash
claude plugin marketplace add Siddhant-K-code/agent-trace && claude plugin install agent-strace@agent-trace
copilot plugin marketplace add Siddhant-K-code/agent-trace && copilot plugin install agent-strace@agent-trace
codex plugin marketplace add Siddhant-K-code/agent-trace && codex plugin add agent-strace@agent-trace
```

In Codex, trust the hooks in `/hooks`. Guides: [Claude Code](docs/claude-code-plugin.md) · [Copilot CLI](docs/copilot-plugin.md) · [Codex](docs/codex-plugin.md). Also: an [MCP server](docs/mcp.md) (`agent-strace mcp`), a [VS Code extension](docs/vscode.md), [machine-wide installs](docs/platform-install.md), and a Python library for your own agent:

```python
from agent_trace import trace_tool, start_session, end_session
```

## Privacy and telemetry

Traces stay local in `.agent-traces/`, with secret redaction on by default ([security](docs/security.md)). Anonymous CLI telemetry is on after a [one-time notice](docs/telemetry.md#when-sending-starts) and off in CI. It never sends prompts, arguments, paths, repository data, or trace contents. Turn it off with `agent-strace telemetry disable` or `DO_NOT_TRACK=1`.

## Labs

`agent-strace --help` shows the core commands. Experimental and specialist ones are in [labs](docs/labs.md) (`agent-strace labs`), including [OpenTelemetry export](docs/production.md), the [collector server](docs/server.md), [auto-instrumentation](docs/integrations.md), `eval` gates, and `watch`. The Action still runs `eval` unless you set `run-eval: "false"`.

## Docs

[Docs index](docs/index.md) · [Review](docs/review.md) · [Command reference](docs/commands.md) · [Setup](docs/setup.md) · [Capture matrix](docs/capture-matrix.md) · [Action inputs](action.yml)

Run the tests with `python -m unittest discover -s tests -v`.

## License

MIT. Use it however you want.

---

<!-- mcp-name: io.github.Siddhant-K-code/agent-trace -->
[Sponsor](https://github.com/sponsors/Siddhant-K-code) · [ADRs](ADRs/) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md) · [Share your use case](docs/index.md#share-your-use-case) · [Release guide](docs/releases.md) · [PyPI](https://pypi.org/project/agent-strace/)
