Skip to main content

agent-trace

PyPI Python CI GitHub Marketplace Open VSX VS Marketplace License PyPI Downloads

Before you merge an agent's pull request, see what its session did and did not prove.

Used by Meta, ByteDance, Zama.ai & more

Meta   ByteDance   Zama

agent-strace is for the person reviewing a coding agent's pull request, and for the team lead who wants to know how much agent-written code merged without review. It records the agent's session (prompts, tool calls, file edits, commands, failures) as local files, then reads that evidence for the pull request:

  • review checks the sessions linked to the branch for rationale, scope, validation, stewardship, and evidence health, and names the evidence behind each finding.
  • share writes a privacy-minimized HTML evidence packet to hand to the reviewer. share --dry-run previews what it would disclose.
  • cognitive-debt reports how much agent-written code has review evidence, by repository or branch.

All three read captured evidence only. They do not read CI results and do not call an LLM. A gap in the capture is reported as a gap, never guessed.

What the reviewer sees

With the GitHub Action, the pull request gets one comment. This is its reviewability table on a demo pull request, trimmed:

Finding Status Confidence Evidence
Rationale present high 1 prompt captured in 1 session.
Scope present medium All 4 written files were named in a prompt or read in the session.
Validation present medium Last run: unittest passed (runner summary in output, not exit code).
Stewardship partial medium 1 human turn, 0 after the first tool call, 0 approval decisions.
Evidence health partial high Health: 1 partial (copilot). Redaction: on. Linked by: branch.

Below the table, the comment lists evidence from commit trailers, links the evidence packet and the cognitive debt result, and says whether the check passed. With no linked session, every finding is inconclusive at low confidence. How to read the findings.

Try it on one pull request

1. Capture the agent's sessions.

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

setup registers the agent's hooks; for Claude Code it prints them for you to merge into ~/.claude/settings.json. A plugin installs the hooks instead; use one or the other, not both. Restart the agent, do one task on a branch, then check what was recorded:

agent-strace replay   # the latest session, in order
agent-strace health   # what the capture recorded and what it missed
Or let your coding agent install it

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

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.

2. Review the branch. In CI, add this workflow. It posts the comment above and uploads the evidence packet as a workflow artifact:

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.0
        with:
          run-eval: "false"
          review: "true"
          cognitive-debt: report
          post-pr-comment: "true"
          github-token: ${{ secrets.GITHUB_TOKEN }}

The job reads the traces in .agent-traces/, so the branch has to carry them. Without CI, run the check on the branch and paste its output into the pull request body:

agent-strace review --format markdown

A pasted table is the author's claim: the author supplies both the change and the evidence. The Action is the stronger path. See the pull request evidence workflow and the Action reference.

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.

What review checks

Each finding has a status (present, partial, missing, or inconclusive) and a confidence (low, medium, or high):

  • Rationale: the prompts that asked for the change.
  • Scope: whether each file the agent wrote was named in a prompt or read in the session.
  • Validation: test and build runs inside the session. Not CI results.
  • Stewardship: human turns and approval decisions during the session.
  • Evidence health: capture gaps, redaction, and how the session was linked to the branch.

A session linked by its git branch, or named on the command line, is a strong link. A session picked by commit time or as the latest one is a weak link and can be unrelated. By default the check fails only on missing at medium confidence or higher; see Threshold.

Hand evidence to a reviewer

agent-strace share --dry-run   # category counts only; writes nothing
agent-strace share             # writes session-<id>.html

The packet omits prompts, responses, commands, paths, and tool values unless you pass --include-content. Do not commit it. With review: "true", the Action builds it as evidence-packet.html in the agent-trace-pr-evidence artifact. See the disclosure preview.

Team view: what merged without review

agent-strace cognitive-debt --since 30d --by repository

It counts agent-written lines with review evidence, such as a GitHub review or a Reviewed-by: trailer naming someone else, and keeps reviewed, unreviewed, and unknown lines apart. Unknown never counts as reviewed. In the Action, cognitive-debt: report adds the result to the comment, and check also fails the step when the result is above the threshold or unknown. It is a workflow metric: it does not measure code quality or rank people. See cognitive debt and review coverage.

Agents and editors

What each agent's hooks expose limits what a review can show. Details: capture matrix.

  • Claude Code: prompts, the final response, tool calls, and failed tools. No model name or token usage.
  • OpenAI Codex: prompts, responses, and tool calls; token usage from Codex 0.164.0. A failed shell command is recorded as a result, not an error.
  • GitHub Copilot CLI: prompts and tool calls. No response text, model name, or token usage.
  • Copilot cloud agent: partial and unverified; only when streamed to a collector.
  • Gemini CLI and Cursor: hook setup is in setup.md; neither is in the capture matrix yet.

Plugins install the hooks plus a skill that runs review before a pull request opens. The Claude Code and Copilot CLI plugins also add a trace analyst agent:

  • Claude Code: claude plugin marketplace add Siddhant-K-code/agent-trace, then claude plugin install agent-strace@agent-trace. Guide.
  • Copilot CLI: copilot plugin marketplace add Siddhant-K-code/agent-trace, then copilot plugin install agent-strace@agent-trace. Guide.
  • Codex: codex plugin marketplace add Siddhant-K-code/agent-trace, then codex plugin add agent-strace@agent-trace, and trust the hooks in /hooks. Guide.

The MCP server (agent-strace mcp) lets an agent run review and read sessions from its own chat. The VS Code extension shows evidence review next to the code.

For your own Python agent, the library records tool and LLM calls without hooks:

from agent_trace import trace_tool, start_session, end_session

See setup.md for every capture path, and platform-install.md for machine-wide installs.

Privacy and telemetry

Traces stay local in .agent-traces/, and secret redaction is on by default. See security.

Anonymous CLI telemetry is on by default once its one-time notice is shown, and is 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. See telemetry.

Labs

agent-strace --help shows the core commands: the three above, capture, session lookup, mcp, and telemetry. The other commands, experimental or for specialist uses, are in labs: run agent-strace labs to list them, or agent-strace --help-all to list every command. They work as before. Labs includes OpenTelemetry export, the collector server, auto-instrumentation, eval gates in CI, the live watch monitor, and compliance reports. The Action still runs eval unless you set run-eval: "false".

Docs

Docs index · Review · Command reference · Setup · Capture matrix · Action inputs

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

License

MIT. Use it however you want.


Sponsor · ADRs · Security · Contributing · Share your use case · Release guide · PyPI

Metadata

Release files for agent-strace 0.127.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-strace 0.127.0
File Size Uploaded Provenance Actions
agent_strace-0.127.0.tar.gz 2.5 MB Without provenance Details for agent_strace-0.127.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-strace 0.127.0
File Interpreter ABI Platform Actions
agent_strace-0.127.0-py3-none-any.whl Python 3 none any Details for agent_strace-0.127.0-py3-none-any.whl

Total release size: 3.4 MB

Release files / agent_strace-0.127.0.tar.gz

Download URL agent_strace-0.127.0.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
f359774a8982dbbd3c63f11253da7a10d4d77f3603f1eb722e7c291ee0c187a7
BLAKE2b-256 checksum
How to use checksums
a4a1ceb530827e08e3734c66bb87118289b4f8f747471e1bd4ed62ad0fc498ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / agent_strace-0.127.0-py3-none-any.whl

Download URL agent_strace-0.127.0-py3-none-any.whl
Size 930.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
139970d15fd815415558454f80cd1c95c56f708850440c7f6aecd74376de96bf
BLAKE2b-256 checksum
How to use checksums
b2d7b1f2b5202211ae2389fe4c164f97a664a761dd263b5d7da04501840bcc15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for agent-strace 0.127.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.127.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page