agents-traces
Append-only JSONL session traces. Assemble rebuilds the chat payload for one request.
Cost/token metrics and session inspect tools. Shared across Cursor, Claude Code, Antigravity, and Zed.
Quickstart
1-Step Setup
pip install agents-traces && agents-traces init
Scaffolds ~/.agents/traces/, autowires MCP configurations into your installed IDEs, and registers assistant skills.
2. Agent-Driven Setup (Zero Friction)
[!TIP] 🤖 Agent-Driven Setup (Zero Friction):
Simply tell your coding agent: "Install and set up agents-traces for me."
The agent installs the package, runsagents-traces init, and automatically diagnoses tool failures usingget_recent_errors.
Source checkouts can also be installed and managed using vand.
Why .agents/traces?
Existing observability platforms (LangSmith, Langfuse, Arize Phoenix) require:
- Heavy Docker stacks (PostgreSQL, ClickHouse, Redis, webservers)
- Cloud accounts, API keys, network latency, and SaaS subscriptions
- Intrusive SDK wrappers that add execution overhead to fast agent loops
agents-traces replaces 500 MB containers with lightweight, append-only JSON lines (~/.agents/traces/):
- Sub-0.05ms Append Speed: Pure atomic file appends with zero lock contention.
- Zero Daemon / Zero Database: Plain daily JSONL logs (
~/.agents/traces/YYYY-MM-DD.jsonl). - Autonomous Self-Healing: Exposes MCP tools (
get_last_session_trace,get_recent_errors) so agents can inspect their own errors and fix failing loops. - Rich Terminal Timeline: LangSmith-style visual timeline directly in your terminal.
Architecture & Flow
┌─────────────────────────────────────────────────────────────┐
│ CODING AGENT / IDE │
│ Cursor · Antigravity · Claude Code · Custom Agents │
└──────────────────────────────┬──────────────────────────────┘
│ Append in <0.05ms
▼
┌─────────────────────────────────────────────────────────────┐
│ LOCAL DAILY TRACE STORE │
│ ~/.agents/traces/YYYY-MM-DD.jsonl │
└──────────────┬───────────────────────────────┬──────────────┘
│ │
▼ ▼
┌─────────────────────────────┐ ┌─────────────────────────────┐
│ TERMINAL TIMELINE │ │ MCP SELF-HEALING │
│ agents-traces stats │ │ get_last_session_trace │
│ agents-traces inspect │ │ get_recent_errors │
│ agents-traces tail -f │ │ Autonomous Loop Repair │
└─────────────────────────────┘ └─────────────────────────────┘
CLI Reference
| Command | Purpose |
|---|---|
agents-traces init |
Plug & Play setup: auto-configures MCP in Cursor, Antigravity, Claude Desktop, Zed |
agents-traces stats |
Displays aggregated tokens, costs, tool success/error breakdown |
agents-traces stats --days 7 |
Aggregates token and tool metrics across the past 7 days |
agents-traces inspect [session-id] |
Renders a rich terminal execution timeline for a session |
agents-traces sessions |
Lists recent active coding sessions with token/cost summaries |
agents-traces tail -f |
Live streams real-time trace events in your terminal |
agents-traces cleanup --keep-days 30 |
Compresses (gzip) or purges traces older than $N$ days |
agents-traces serve |
Runs the FastMCP stdio server (default) |
MCP Tools Reference
| Tool | Parameters | Description |
|---|---|---|
get_last_session_trace |
session_id (optional), limit (default: 40) |
Returns the complete chronological execution timeline of tools, model calls, and file edits. |
get_recent_errors |
limit (default: 10), session_id (optional) |
Retrieves recent failed tool calls, error stack traces, and arguments for agent self-repair. |
get_session_stats |
days (default: 1) |
Aggregates token consumption, estimated USD costs, and tool success rates. |
record_trace |
session, type, tool, status, error, duration_ms |
Programmatically logs custom trace events into the local JSONL store. |
Supported Ecosystem
- Claude Code: Bound via MCP server and
.agents/skills/trace-inspect. - Google Antigravity: Integrated via
.gemini/configrules andagents-tracesMCP. - Cursor: Automatically configures
.cursor/mcp.jsonand agent rules. - Zed: Configures
context_serversand mirrors assistant skills. - VS Code / Windsurf: Autowires Cline / Roo-Code MCP configuration.
Open ABI Specification
Detailed architectural specifications live in abi/:
abi/WHY.md— Rationale & why lightweight JSONL beats heavy Docker stacks.abi/LAYOUT.md— Daily partition taxonomy in~/.agents/traces/.abi/SCHEMA.md— Full JSON schema for trace events and spans.abi/MCP.md— Tool surface definitions and schemas.abi/CLI.md— Terminal commands and formatting specification.
Testing & Verification
Run the test suite across all engines:
python tests/run_all_tests.py
License
MIT License. See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agents_traces-0.0.1.tar.gz.
File metadata
- Download URL: agents_traces-0.0.1.tar.gz
- Upload date:
- Size: 50.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
560d2ce0fcc56afc1cb384e4d7e6e7136ee41471e662bc87b43649e30f55e28c
|
|
| MD5 |
f3dbf090595d455eec38e5e1ce39e706
|
|
| BLAKE2b-256 |
fd57d5f2f3de04d4d0135947a77df6a45cd18a405dac8b2f3d80b7c60e1fd3ee
|
File details
Details for the file agents_traces-0.0.1-py3-none-any.whl.
File metadata
- Download URL: agents_traces-0.0.1-py3-none-any.whl
- Upload date:
- Size: 49.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b755acff8ac114301b586aa4086179bae9e86fd14aa8bd4fd53f45437cdfe680
|
|
| MD5 |
8cde9aabe35a0f602269b39b87fe80d8
|
|
| BLAKE2b-256 |
8ab252c1fd66c76fc20a803f83ea6fd99f7c35295b9282d96be14b3b46e1fa4a
|