AgentOps: Monitor, Debug, and Optimize Your AI Agents in Production
AgentOps records every session your AI agents run, logging LLM calls, tool use, costs, and errors - with replay capabilities for debugging and integration with CrewAI, AutoGen, and LangChain.
Mahmudul Haque Qudrati
CEO & ML Engineer
One AI engineering post, weekly
LLM benchmarks, prompt techniques, and token-cost breakdowns — not another AI news roundup.
When a traditional API fails, you look at logs. When an AI agent produces wrong output or fails mid-task, the failure is harder to diagnose: was it the LLM's reasoning? A tool call that returned bad data? An error in how results were parsed? AgentOps fills this gap by recording everything an agent does in a structured, replayable session.
Quick Setup
import agentops
from openai import OpenAI
agentops.init(api_key="YOUR_AGENTOPS_API_KEY")
client = OpenAI()
# All subsequent OpenAI calls are automatically tracked
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Plan a 3-day trip to Tokyo"}]
)
agentops.end_session("Success")
Every LLM call in the session is logged with: model name, prompt, completion, latency, token counts, and cost. Sessions appear in the AgentOps dashboard immediately.
Team workspace
Ship faster with chat, meetings, and projects in one place — Zlyqor.
Session Recording
A session captures the complete execution trace of an agent run:
- LLM calls - input messages, output, model, latency, tokens, estimated cost
- Tool calls - which tool was called, what arguments were passed, what it returned
- Agent decisions - the chain of reasoning that led to each action
- Errors - exceptions, API failures, parsing errors with full stack traces
- End state - Success, Fail, or Indeterminate
CrewAI Integration
from crewai import Agent, Task, Crew
import agentops
agentops.init(api_key="YOUR_KEY")
researcher = Agent(
role="Researcher",
goal="Find the latest AI developments",
backstory="Expert research analyst",
)
# AgentOps automatically tracks all LLM calls made by CrewAI agents
crew = Crew(agents=[researcher], tasks=[research_task])
result = crew.kickoff()
agentops.end_session("Success")
Cost Attribution
AgentOps tracks per-session cost broken down by model and call type. For multi-agent workflows running at scale, this lets you identify which agents or tasks are responsible for the majority of your LLM spend - often the first step toward optimization.
Error Replay
When an agent run fails, AgentOps records the exact state at failure: what was in context, what tool was being called, what the error was. You can replay the failed session in the dashboard and step through the execution to identify the root cause.
AgentOps vs LangSmith
LangSmith is deeply integrated with the LangChain ecosystem and excels at tracing LangChain chains and agents. AgentOps is framework-agnostic (works equally well with CrewAI, AutoGen, direct OpenAI calls) and has stronger session-level cost tracking. If you're using LangChain heavily, LangSmith is the natural choice. For multi-framework or framework-free agent work, AgentOps provides better coverage.
Resources
Mahmudul Haque Qudrati
CEO & ML Engineer
Visionary leader with extensive experience in machine learning and software development. Drives strategic innovation and business growth.
More from Mahmudul
Related Articles
How to Use Claude to Make Videos Like Vox and Others
Claude can help you make Vox-style videos by generating scripts, editing with code, and automating animation. Here's a practical guide with real workflows and costs.
OpenAI Ends Cursor Model Access on Nov 12, 2026: What Developers Need to Know
OpenAI will terminate Cursor's access to its models on November 12, 2026, following SpaceX's acquisition. This guide explains the timeline, why it happened, and practical steps to migrate your workflow.
Ox Alpha That Became GLM 5.3 Flash: From Mystery to Preview, Everything We Know
Ox Alpha, the anonymous AI model that topped coding benchmarks, turned out to be GLM-5.3-Flash from Zhipu. Here's the full story, from mystery to official preview, with evidence and practical details.
// discussion
Comments