From zero to full agent observability in 3 lines of code. Pick your framework and copy-paste.
AgentGuard has zero runtime dependencies. One install, nothing else to pull in.
pip install agentguard47
Create a Tracer with an HttpSink and wrap your agent logic in a trace context. Every span, event, and cost metric flows to the dashboard automatically.
from agentguard47 import Tracer from agentguard47.sinks.http import HttpSink sink = HttpSink(url="https://app.agentguard47.com/api/ingest", api_key="ag_...") tracer = Tracer(sink=sink, service="my-agent") with tracer.trace("agent.run") as span: span.event("reasoning.step", data={"thought": "search docs"}) with span.span("tool.search"): pass # your tool call here
Get your API key from app.agentguard47.com → Settings → API Keys.
One call patches the OpenAI client to automatically track cost per call — token counts, model, and dollar amounts flow into every trace.
from agentguard47.instrument import patch_openai patch_openai(tracer) # auto-tracks cost per call
AgentGuard ships a native LangChain callback handler. Pass it to any agent or chain and every LLM call, tool invocation, and chain step is traced automatically.
from agentguard47.integrations.langchain import AgentGuardHandler handler = AgentGuardHandler(tracer=tracer) agent.invoke({"input": "..."}, config={"callbacks": [handler]})
Wrap your crew.kickoff() call in a trace span. Tag the crew name and capture the output for full visibility into multi-agent orchestration.
with tracer.trace("crew.run") as span: span.set("crew.name", "research-crew") result = crew.kickoff() span.set("crew.output", str(result))
Wrap your GroupChat manager run in a trace. Capture the message count to track conversation depth and detect runaway chats.
with tracer.trace("autogen.chat") as span: chat_result = manager.run(message="research topic") span.set("autogen.messages", len(chat_result.chat_history))
Instrument individual MCP tool calls with nested spans. Each tool invocation gets its own timing and metadata in the trace waterfall.
with tracer.trace("mcp.session") as span: with span.span("tool.file_read"): result = await session.call_tool("read_file", {"path": "data.csv"})
Set a hard dollar cap. When your agent exceeds the budget, AgentGuard stops it automatically — no $2,000 surprise invoices.
from agentguard47 import BudgetGuard guard = BudgetGuard(max_cost_usd=5.00) # Agent stops automatically when budget exceeded
Once events are flowing, sign into the dashboard to see:
Pro-level access with 500K events/month. No credit card required.
Start Free Trial