ScriptsApr 6, 2026·2 min read

AgentOps — Observability Dashboard for AI Agents

Python SDK for monitoring AI agent sessions with real-time dashboards, token tracking, cost analysis, and error replay. Two lines of code to instrument any framework. 4,500+ GitHub stars.

TL;DR
Two-line Python SDK that adds real-time dashboards, token tracking, and error replay to AI agents.
§01

What it is

AgentOps is a Python SDK for monitoring AI agent sessions with real-time dashboards. It tracks token usage, costs, latency, tool calls, and errors across agent runs. Integration requires adding just two lines of code to your existing agent. The dashboard provides session replay, allowing you to step through an agent's decisions and tool invocations to debug failures.

AgentOps targets developers building AI agents who need visibility into what their agents are doing, how much they cost, and where they fail. It works with any Python agent framework including LangChain, CrewAI, AutoGen, and custom implementations.

§02

How it saves time or tokens

Without observability, debugging a failing agent means adding print statements and re-running sessions. AgentOps records every LLM call, tool invocation, and state transition automatically. The session replay lets you pinpoint exactly where an agent went wrong without re-executing. Token and cost tracking across sessions helps identify which agent patterns are expensive and which are efficient.

§03

How to use

  1. Install the SDK:
pip install agentops
  1. Add two lines to your agent code:
import agentops
agentops.init('YOUR_API_KEY')  # Get free key at agentops.ai

# Your existing agent code runs unchanged
# AgentOps auto-instruments LLM calls and tool invocations
  1. View sessions in the AgentOps dashboard at app.agentops.ai.
§04

Example

Instrumenting a LangChain agent:

import agentops
from langchain.agents import create_openai_tools_agent

agentops.init('YOUR_API_KEY')

# Build your agent as usual
agent = create_openai_tools_agent(llm, tools, prompt)
result = agent.invoke({'input': 'Analyze the latest sales data'})

# AgentOps automatically captures:
# - Each LLM call with tokens and latency
# - Tool calls with inputs/outputs
# - Total session cost
# - Any errors or retries

agentops.end_session('Success')
§05

Related on TokRepo

§06

Common pitfalls

  • AgentOps sends telemetry data to its cloud dashboard; for sensitive workloads, check the data retention policy and consider self-hosted alternatives
  • Auto-instrumentation may not capture custom tool calls; use the @agentops.record decorator to manually instrument non-standard tools
  • Free tier has session limits; high-volume agent deployments should plan for the paid tier or batch sessions

Frequently Asked Questions

Which agent frameworks does AgentOps support?+

AgentOps provides auto-instrumentation for LangChain, CrewAI, AutoGen, and direct OpenAI/Anthropic SDK calls. For other frameworks, you can use the manual recording API with decorators and context managers.

Is there a free tier?+

Yes. AgentOps offers a free tier with limited sessions per month. You can get a free API key at agentops.ai. Paid plans increase the session limit and add features like team collaboration and extended data retention.

What data does AgentOps capture?+

AgentOps captures LLM calls (model, tokens, latency, cost), tool invocations (name, inputs, outputs), agent state transitions, errors, and session metadata. It does not modify your agent's behavior or outputs.

Can I self-host AgentOps?+

AgentOps is primarily a SaaS product with a cloud dashboard. The SDK is open source, but the dashboard and storage backend are hosted by AgentOps. Check their documentation for any self-hosting options.

How does session replay work?+

Session replay shows a timeline of every action your agent took during a session: LLM calls, tool invocations, decision points, and errors. You can step through the timeline to see exactly what the agent did and why it made specific choices.

Citations (3)
🙏

Source & Thanks

Created by AgentOps-AI. Licensed under MIT.

agentops — ⭐ 4,500+

Thanks to the AgentOps team for bringing production observability to AI agents.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets