Lightweight observability and evaluation primitives for multi-agent systems
Project description
AgentGuard SDK (Python)
Lightweight, zero-dependency observability for multi-agent AI systems. Trace reasoning steps, catch loops, guard budgets, and replay runs deterministically.
Install
pip install agentguard47
With LangChain support:
pip install agentguard47[langchain]
Quickstart
from agentguard import Tracer, LoopGuard, BudgetGuard
tracer = Tracer()
loop_guard = LoopGuard(max_repeats=3)
budget_guard = BudgetGuard(max_tokens=10000)
with tracer.trace("agent.run") as span:
span.event("reasoning.step", data={"thought": "search docs"})
loop_guard.check(tool_name="search", tool_args={"query": "agent loops"})
budget_guard.record_tokens(150)
with span.span("tool.call", data={"tool": "search"}):
pass # call your tool here
Tracing
from agentguard.tracing import Tracer
tracer = Tracer()
with tracer.trace("agent.run", data={"user_id": "u123"}) as span:
span.event("reasoning.step", data={"step": 1, "thought": "search docs"})
with span.span("tool.call", data={"tool": "search", "query": "agent loops"}):
pass
Guards
from agentguard.guards import LoopGuard, BudgetGuard, TimeoutGuard
# Detect repeated tool calls
guard = LoopGuard(max_repeats=3)
guard.check(tool_name="search", tool_args={"query": "agent loops"})
# Track token and call budgets
budget = BudgetGuard(max_tokens=50000, max_calls=100)
budget.record_tokens(150)
budget.record_call()
# Enforce wall-clock time limits
timeout = TimeoutGuard(max_seconds=30)
timeout.start()
timeout.check() # raises TimeoutExceeded if over limit
Replay
from agentguard.recording import Recorder, Replayer
recorder = Recorder("runs.jsonl")
recorder.record_call("llm", {"prompt": "hi"}, {"text": "hello"})
replayer = Replayer("runs.jsonl")
resp = replayer.replay_call("llm", {"prompt": "hi"})
CLI
# Summarize trace events
agentguard summarize traces.jsonl
# Human-readable report
agentguard report traces.jsonl
# Open trace viewer in browser
agentguard view traces.jsonl
Trace Viewer
agentguard view traces.jsonl --port 8080
Integrations
- LangChain:
agentguard.integrations.langchain
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentguard47-0.2.0.tar.gz
(14.5 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 agentguard47-0.2.0.tar.gz.
File metadata
- Download URL: agentguard47-0.2.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236020d0bdbe12fa325e72b82e1b616ac301a3a6c666e83a70743019faccd108
|
|
| MD5 |
7fb24d5ae46d2467543d97e46fbc1c32
|
|
| BLAKE2b-256 |
8dde158e0ddc297f0b70d64e8b67fd6899aa0e9cbecc07ec1cc25965a157158f
|
File details
Details for the file agentguard47-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentguard47-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3193f5e1d9d35c6133645ffd56e10e0dd7bd6f4e2b447565326b4065d0bdc07
|
|
| MD5 |
77e82f7110e81c32048d8e03025bbd04
|
|
| BLAKE2b-256 |
a9963eacc34dcf927cb2e524fec82f23e7e0abb5b7cd4dd1e1696e632c210f5f
|