Skip to content
Claude Certified Architect – Professional (CCAR-P) Exam Prep

Lesson 15 of 31 · 7 min

x
15/31

Observability and Monitoring for Agents at Scale

Video lesson: CCAR-P 15/31: Observability and Monitoring for Agents at Scale

What the platform gives you

  • The Agent SDK exports OpenTelemetry traces, metrics and log events over OTLP to any compatible backend (hosted platform or self-hosted collector): which tools were called, how long each model request took, tokens spent where, where failures occurred.
  • Claude Code enables export with CLAUDE_CODE_ENABLE_TELEMETRY=1 and standard OTel variables (OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTER, OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS); administrators can set these for all users through managed settings.
  • Metrics include claude_code.token.usage, claude_code.cost.usage, claude_code.session.count, claude_code.lines_of_code.count, claude_code.commit.count, claude_code.pull_request.count, claude_code.active_time.total, claude_code.code_edit_tool.decision. Attributes such as skill.name, plugin.name and agent.name attribute spend to skills, plugins and subagent types.
  • Cost figures are approximations: SDK total_cost_usd and the cost metric are client-side estimates from a bundled price table; use your provider's billing data (Console, Bedrock, Google Cloud) as the authoritative source. Data-residency pricing is modelled (a 1.1 multiplier when a response reports inference_geo: "us").
  • API responses expose usage (input, output, cache creation, cache read tokens) and a stop_reason; messages from inside a subagent carry parent_tool_use_id (and agent_id in TypeScript).
  • Hooks (PreToolUse, PostToolUse, SubagentStop, Notification) support audit logging; an async hook can log without blocking.
  • The platform also has a usage and cost API, an admin API, and a Compliance API for activity and session data (existence verified; see admin docs).

What to monitor (design guidance)

AreaSignals
CostTokens and spend per request, user, team, agent, skill; budget burn; cost per completed task
LatencyTime to first token, total time, tool latency, queue time; p50 and p95
ReliabilityError and retry rates, stop_reason mix (max_tokens, refusal, model_context_window_exceeded), tool failures, timeouts
QualityEvaluation scores on sampled traffic, validator failures, user ratings, escalation rate
EfficiencyCache hit rate, tool calls per task, turns per task, context size growth
SafetyDenied tool calls, guardrail trips, injection signals, refusals

Operating practice (design guidance)

  • Trace a request end to end (a trace id across orchestrator, subagents and tools).
  • Alert on thresholds and anomalies (cost spike, rising refusal or error rate, falling cache hits, quality drop).
  • Sample and review outputs; feed failures into the evaluation set (D1.4).
  • Respect privacy: telemetry and logs can contain sensitive prompts; redact, restrict access and set retention (D5.4).
  • Set budgets and caps so monitoring has teeth (maxBudgetUsd, workspace limits).

Exam traps

  • Treating client-side cost estimates as the bill.
  • Monitoring cost only, not quality.
  • Logging raw sensitive prompts with open access.
  • No trace correlation across subagents.
  • Alerts without an owner.

References

  1. Observability with OpenTelemetry (Agent SDK) — checked Oct 16, 2026
  2. Monitoring usage — checked Oct 16, 2026
  3. Track cost and usage — checked Oct 16, 2026

Check your understanding

  • Which source is authoritative for billing?Show answer

    Answer

    The provider's billing data, not client-side estimates.
  • How do you attribute spend to a specific subagent type?Show answer

    Answer

    Telemetry attributes such as agent.name on the usage metrics.
  • Name two stop reasons worth alerting on.Show answer

    Answer

    max_tokens (truncation) and refusal.
Previous

Progress is saved in this browser.

Next Lesson