AgentTrace SDK - AI Agent Observability & Debugging
Project description
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
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
agenttrace_sdk-1.0.0.tar.gz
(9.0 kB
view details)
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 agenttrace_sdk-1.0.0.tar.gz.
File metadata
- Download URL: agenttrace_sdk-1.0.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6e7f1163d89e77a9850886b5dd8d69eaf115d214d082afb965f4b848bcbd5d9
|
|
| MD5 |
aadfe2a6f5fa4a3f6fd9144f0d3b76b3
|
|
| BLAKE2b-256 |
bef01ce7b47398dd11ee6068ed54d6d8e7a4cfb0ea72c3e8b32470c155f7f58b
|
File details
Details for the file agenttrace_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: agenttrace_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0f9ec63bc00d29fbe6d0f88a279d80844ac139452d5f814b2b7216bf982e152
|
|
| MD5 |
23fefed67cd4f91478031512c1f4cf01
|
|
| BLAKE2b-256 |
7bfd57b0ee419947f186b18dc853dc138ad8dcf29be59f1f1b73c34948b57843
|