Skip to main content

Agent tracing: step-by-step execution traces for AI agent debugging

Project description

MCP Agent Trace — Observability for AI Agent Loops

Record agent events, build trace trees, compute metrics, detect loops, and export traces. Zero dependencies, pure Python stdlib.

The Problem

Agent decisions are black boxes. No way to trace what happened, what tokens were spent on, where loops occurred. Debugging agent failures requires guessing.

The Solution

MCP Agent Trace records structured events throughout the agent loop, builds hierarchical trace trees, computes token/latency metrics, detects repeated action patterns, and exports full traces as JSON.

Tools (12)

Tool What it does
start_trace Begin a new trace session
end_trace End session, compute summary metrics
log_event Record a structured event (tool_call, decision, error, milestone)
get_trace Get full trace tree for a session
get_metrics Token usage, tool calls, latency, loop detection
detect_loops Find repeated tool-call patterns
export_trace Export as JSON for external analysis
list_sessions List all trace sessions
get_timeline Chronological event timeline
annotate Add human annotation to an event
get_stats Aggregate statistics across sessions
reset Clear all sessions and traces

Tests

python -m pytest tests/ -v  # 28 tests, all passing

Inspiration

License

MIT — aaameobius-crypto

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_agent_trace-1.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_agent_trace-1.0.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_agent_trace-1.0.0.tar.gz.

File metadata

  • Download URL: mcp_agent_trace-1.0.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for mcp_agent_trace-1.0.0.tar.gz
Algorithm Hash digest
SHA256 554a2984980b614ad2dae53bed8c3099cce01653f994bf9e18fc0ae632c564aa
MD5 3b810459063577f40e96f65cce44673a
BLAKE2b-256 dd21d525d750f52d361bf0f18e38df853ef50071f9d1c38c4e678147ef0e52c2

See more details on using hashes here.

File details

Details for the file mcp_agent_trace-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_agent_trace-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 645512726f2dd36c610f7259cf2addec0417cc7b002bd6ef309c857ea46c806f
MD5 369dc2c81b1cc14772d0c28c62b3473f
BLAKE2b-256 ce2c662e1aa4bc5b4e3fe9c42a5435680c13d942850ee471f66a172dc13ba220

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page