Agent ops: see, control and improve agents in production
Trace agent runs with Langfuse, Laminar, LangSmith, Phoenix and OpenTelemetry, control them with permissions, hooks, budgets and kill switches, and improve them with trajectory evals, prompt caching and model routing.
On this page
- What it is
- When to use it
- Members only: See: telemetry, traces and dashboards
- Members only: Control: decide what runs and how far
- Members only: Improve: evals, caching, routing and pruning
- Members only: Respond when an agent misbehaves
- Members only: Patterns that work
- Members only: Mistakes to avoid
- Members only: Exercises
An agent in production is a loop nobody watched: it chose tools, read data and spent money on its own. Agent ops is three jobs. See what each run did. Control what any run may do. Improve results per task, per dollar and per second. Most teams build the first, skip the second and argue about the third without data.
What it is#
| Job | What it tells you | Mechanisms |
|---|---|---|
| See | What each run did, in what order, at what cost, and where it failed | Traces, trajectories, metrics, events |
| Control | What an agent may do, how much it may spend, and how to stop it | Permissions, hooks, budgets, approvals, rate limits, kill switches |
| Improve | Whether the last change made results better or worse | Trajectory evals, prompt caching, model routing, context pruning |
A trace shows one task as a tree of spans: the agent invocation at the root, its model calls and tool calls below it, and any subagents nested under the tool call that started them. A trajectory is the same run as an ordered list of steps, the messages and tool calls in sequence. You debug with traces and you score with trajectories.
The shared vocabulary comes from the OpenTelemetry semantic conventions for generative AI, now maintained in their own repository and still marked Development, so names can change. Agent work uses the operations invoke_agent, create_agent, invoke_workflow, plan and execute_tool, with attributes such as gen_ai.operation.name, gen_ai.agent.name, gen_ai.agent.id, gen_ai.provider.name and gen_ai.tool.name. A separate convention covers MCP calls.
Claude Code emits its own spans when tracing is on. Each prompt starts a claude_code.interaction span. Model calls are claude_code.llm_request children, tool calls are claude_code.tool children with blocked_on_user and execution spans beneath them, and a subagent's spans nest under the tool call that spawned it. When Claude Code talks to the Anthropic API directly, the W3C trace context travels into Bash commands through TRACEPARENT and onto model and HTTP MCP requests; behind a custom ANTHROPIC_BASE_URL proxy, set CLAUDE_CODE_PROPAGATE_TRACEPARENT=1 to keep it. The MCP 2026-07-28 revision documents the same traceparent key for MCP messages. An app that starts Claude Code through the Agent SDK can therefore see the agent's spans inside its own trace.
When to use it#
You need agent ops when any of these is true:
- Agents run unattended: routines, CI jobs, scheduled reports, background sessions.
- Other people rely on an agent's output, such as support replies or pull requests.
- Spend grows and nobody can say which team, model or tool drives it.
- You change prompts, models, tools or
CLAUDE.mdand want to know whether results got better. - The agent touches regulated data and you must show who did what.
For one developer in interactive sessions, it is overkill. /usage shows session cost, prompt cache statistics and what counts against your plan, and /context shows what fills the window.
Pick tools by the job, not the logo:
| Tool | Strongest at | Claude integrations | Learn more |
|---|---|---|---|
| Langfuse | Open source tracing with sessions and agent graphs, LLM-as-judge evaluators, datasets and experiments with CI thresholds | A Claude Code plugin that converts session transcripts into traces, a Claude Agent SDK integration, and an OTLP endpoint | Langfuse |
| Laminar | Open source tracing plus Signals, plain-language failure detection run over every trace, a debugger that replays runs, and SQL over traces | A Claude Code plugin and a Claude Agent SDK integration | Laminar |
| LangSmith and LangSmith Studio | A trajectory view, Insights over production traces, and Studio, the agent IDE for running and debugging LangGraph agents with time travel | Documented Claude Code tracing; AgentEvals for trajectory scoring | LangGraph |
| Arize Phoenix | Open source, built on OpenTelemetry and OpenInference, with sessions and pre-built evaluators for tool invocation and tool response handling | Documented tracing for the Claude Code CLI and the Agent SDK | Arize Phoenix |
| Your existing OpenTelemetry backend | Metrics, alerts and audit next to the rest of your systems | Claude Code exports metrics, events and beta traces natively | OpenTelemetry GenAI |
If you build your own agent on the Claude Agent SDK, you get the same telemetry as Claude Code, because the SDK runs the Claude Code CLI underneath and passes your settings through.
See: telemetry, traces and dashboards
Members only below this line
Get the rest of this guide free
What you get on this page:
- 1 skill
- 1 hook
Also in the members part
- Control: decide what runs and how far
- Improve: evals, caching, routing and pruning
- Respond when an agent misbehaves
- Patterns that work
- Mistakes to avoid
- Exercises
Sources
Checked against these on 13 Oct 2026.
- Claude Code: monitoring with OpenTelemetry (metrics, events, traces) (opens in a new tab)code.claude.com
- Claude Agent SDK: observability with OpenTelemetry (opens in a new tab)code.claude.com
- Claude Agent SDK: Python reference (opens in a new tab)code.claude.com
- Claude Agent SDK: configure your agent (turn and budget caps) (opens in a new tab)code.claude.com
- Claude Agent SDK: hooks (opens in a new tab)code.claude.com
- Claude Code: manage costs effectively (opens in a new tab)code.claude.com
- Claude Code: how Claude Code uses prompt caching (opens in a new tab)code.claude.com
- Claude API: prompt caching (opens in a new tab)platform.claude.com
- Claude Code: model configuration (opens in a new tab)code.claude.com
- Claude Code: hooks reference (opens in a new tab)code.claude.com
- Claude Code: CLI reference (opens in a new tab)code.claude.com
- Claude Code: deploy managed settings (opens in a new tab)code.claude.com
- OpenTelemetry semantic conventions for GenAI agent spans (opens in a new tab)github.com
- Langfuse: trace Claude Code (opens in a new tab)langfuse.com
- Langfuse: OpenTelemetry endpoint (opens in a new tab)langfuse.com
- Langfuse: agent graphs (opens in a new tab)langfuse.com
- Laminar documentation (opens in a new tab)laminar.sh
- LangSmith Studio (opens in a new tab)docs.langchain.com
- LangChain: agent evals with AgentEvals (opens in a new tab)docs.langchain.com
- Arize Phoenix: pre-built evaluation metrics (opens in a new tab)arize.com
- Arize Phoenix: Claude Code integration (opens in a new tab)arize.com
- MCP specification 2026-07-28: key changes (opens in a new tab)modelcontextprotocol.io