AgentTrace SDK
AI Agent Observability & Debugging - Record, replay, and debug your AI agents.
🚀 Quick Start
pip install agenttrace-sdk
from agenttrace import AgentTrace
# Initialize with your API key
tracer = AgentTrace(api_key="at_your_api_key_here")
# Start a trace session
tracer.start("my_agent.py")
# Record agent activities
tracer.thought("Analyzing the user's request...")
tracer.tool_start("web_search", {"query": "latest AI news"})
tracer.tool_end("web_search", {"results": [...]})
# End the session
tracer.end()
📋 Features
- 📍 Event Recording - Capture thoughts, tool calls, file writes, and exceptions
- 🔄 Replay Execution - Re-run your agent with deterministic results
- 🌿 Branch & Fork - Create alternate timelines from any point
- 🔍 Compare Runs - Side-by-side diff of different executions
- 🛠️ AutoFix Engine - AI-powered error detection and fixes
🔧 API Reference
Initialize Client
from agenttrace import AgentTrace
tracer = AgentTrace(
api_key="at_xxx...", # Your API key (required)
endpoint="https://app.agenttrace.io", # API endpoint (optional)
batch_size=10, # Events before auto-flush
flush_interval=1.0 # Seconds between flushes
)
Record Events
# Record a thought/reasoning step
tracer.thought("Planning the next action...")
# Record tool invocation
tracer.tool_start("calculator", {"expression": "2+2"})
tracer.tool_end("calculator", result=4)
# Record file operations
tracer.file_write("/path/to/file.txt", "content here")
# Record exceptions
tracer.exception("ValueError", "Invalid input", traceback_str)
Context Manager
with tracer.session("my_script.py") as trace_id:
tracer.thought("Starting...")
# Your agent code here
# Automatically ends with status "completed" or "failed"
Decorator
from agenttrace import trace
@trace
def my_function(x, y):
return x + y # Automatically traced!
🔑 Get Your API Key
- Sign up at agenttrace.io
- Go to Settings → API Keys
- Create a new key
- Copy and use in your code
# Or set via environment variable
export AGENTTRACE_API_KEY="at_your_key_here"
# Then just:
tracer = AgentTrace() # Auto-reads from env
📊 View Your Traces
After recording, view your traces at:
- Dashboard:
https://app.agenttrace.io/dashboard/traces - Individual Trace:
https://app.agenttrace.io/trace/{trace_id}
🌐 Self-Hosted
For self-hosted deployments:
tracer = AgentTrace(
api_key="at_xxx...",
endpoint="https://your-domain.com" # Your self-hosted instance
)
📄 License
MIT License - see LICENSE for details.
🔗 Links
- Website: agenttrace.io
- Documentation: docs.agenttrace.io
- Support: agenttraceismoat@gmail.com
Release files for agenttrace-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agenttrace_sdk-1.0.0.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agenttrace_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 kB
Release files / agenttrace_sdk-1.0.0.tar.gz
| Download URL | agenttrace_sdk-1.0.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6e7f1163d89e77a9850886b5dd8d69eaf115d214d082afb965f4b848bcbd5d9
|
|
BLAKE2b-256 checksum How to use checksums |
bef01ce7b47398dd11ee6068ed54d6d8e7a4cfb0ea72c3e8b32470c155f7f58b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / agenttrace_sdk-1.0.0-py3-none-any.whl
| Download URL | agenttrace_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0f9ec63bc00d29fbe6d0f88a279d80844ac139452d5f814b2b7216bf982e152
|
|
BLAKE2b-256 checksum How to use checksums |
7bfd57b0ee419947f186b18dc853dc138ad8dcf29be59f1f1b73c34948b57843
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|