GuideCraft · Advanced

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.

Checked 13 Oct 202618 min read1 skill1 hook

On this page
  1. What it is
  2. When to use it
  3. Members only: See: telemetry, traces and dashboards
  4. Members only: Control: decide what runs and how far
  5. Members only: Improve: evals, caching, routing and pruning
  6. Members only: Respond when an agent misbehaves
  7. Members only: Patterns that work
  8. Members only: Mistakes to avoid
  9. 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#

JobWhat it tells youMechanisms
SeeWhat each run did, in what order, at what cost, and where it failedTraces, trajectories, metrics, events
ControlWhat an agent may do, how much it may spend, and how to stop itPermissions, hooks, budgets, approvals, rate limits, kill switches
ImproveWhether the last change made results better or worseTrajectory 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.

1. The root span agent.run opens and covers the whole run. 2. llm.plan: the model plans, 1,840 tokens. 3. tool.read_file reads the failing test. 4. llm.decide picks the next step. 5. tool.run_tests fails. 6. The agent retries tool.run_tests and it passes. 7. llm.write_fix takes 6.2 seconds and is flagged slow. 8. tool.edit_file applies the fix and llm.summarize writes the answer. 9. The run ends at 18.4 seconds: 12,480 tokens and 0.042 dollars.Trace · fix the failing testTokens0Cost$0.000Time0.0 s0 s5 s10 s15 s20 sagent.runllm.plantool.read_filellm.decidetool.run_testsfailedtool.run_testsretry passedllm.write_fixslow · 6.2 stool.edit_filellm.summarizeModel callTool call

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.md and 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:

ToolStrongest atClaude integrationsLearn more
LangfuseOpen source tracing with sessions and agent graphs, LLM-as-judge evaluators, datasets and experiments with CI thresholdsA Claude Code plugin that converts session transcripts into traces, a Claude Agent SDK integration, and an OTLP endpointLangfuse
LaminarOpen source tracing plus Signals, plain-language failure detection run over every trace, a debugger that replays runs, and SQL over tracesA Claude Code plugin and a Claude Agent SDK integrationLaminar
LangSmith and LangSmith StudioA trajectory view, Insights over production traces, and Studio, the agent IDE for running and debugging LangGraph agents with time travelDocumented Claude Code tracing; AgentEvals for trajectory scoringLangGraph
Arize PhoenixOpen source, built on OpenTelemetry and OpenInference, with sessions and pre-built evaluators for tool invocation and tool response handlingDocumented tracing for the Claude Code CLI and the Agent SDKArize Phoenix
Your existing OpenTelemetry backendMetrics, alerts and audit next to the rest of your systemsClaude Code exports metrics, events and beta traces nativelyOpenTelemetry 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

1. Turn on Claude Code telemetry Set these variables in your shell, in ~/.claude/settings.json under env , or for everyone through managed settings (step 2). A repository's .claude/settings.json cannot turn exporters on or redirect them.

Members only below this line

Get the rest of this guide free

What you get on this page:

  • 1 skill
  • 1 hook

Free. You also get Stratiflux Weekly: one email a week, unsubscribe anytime.

Also in the members part

  1. Control: decide what runs and how far
  2. Improve: evals, caching, routing and pruning
  3. Respond when an agent misbehaves
  4. Patterns that work
  5. Mistakes to avoid
  6. Exercises

Sources

Checked against these on 13 Oct 2026.

  1. Claude Code: monitoring with OpenTelemetry (metrics, events, traces) (opens in a new tab)code.claude.com
  2. Claude Agent SDK: observability with OpenTelemetry (opens in a new tab)code.claude.com
  3. Claude Agent SDK: Python reference (opens in a new tab)code.claude.com
  4. Claude Agent SDK: configure your agent (turn and budget caps) (opens in a new tab)code.claude.com
  5. Claude Agent SDK: hooks (opens in a new tab)code.claude.com
  6. Claude Code: manage costs effectively (opens in a new tab)code.claude.com
  7. Claude Code: how Claude Code uses prompt caching (opens in a new tab)code.claude.com
  8. Claude API: prompt caching (opens in a new tab)platform.claude.com
  9. Claude Code: model configuration (opens in a new tab)code.claude.com
  10. Claude Code: hooks reference (opens in a new tab)code.claude.com
  11. Claude Code: CLI reference (opens in a new tab)code.claude.com
  12. Claude Code: deploy managed settings (opens in a new tab)code.claude.com
  13. OpenTelemetry semantic conventions for GenAI agent spans (opens in a new tab)github.com
  14. Langfuse: trace Claude Code (opens in a new tab)langfuse.com
  15. Langfuse: OpenTelemetry endpoint (opens in a new tab)langfuse.com
  16. Langfuse: agent graphs (opens in a new tab)langfuse.com
  17. Laminar documentation (opens in a new tab)laminar.sh
  18. LangSmith Studio (opens in a new tab)docs.langchain.com
  19. LangChain: agent evals with AgentEvals (opens in a new tab)docs.langchain.com
  20. Arize Phoenix: pre-built evaluation metrics (opens in a new tab)arize.com
  21. Arize Phoenix: Claude Code integration (opens in a new tab)arize.com
  22. MCP specification 2026-07-28: key changes (opens in a new tab)modelcontextprotocol.io