Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Production Agent Systems

Free · sign in to start and track progress

1 · Architecture

  • 1Multi-agent systems
  • 2Durable, long-running agents
  • 3Security and prompt injection

2 · Operating agents

  • 4Compliance and auditability
  • 5Observability and cost

    Exercise answers

    • Answer: Trace Claude Code runs and build a per-matter budget report
    • Answer: Session budgets and redacted exports in eve
  • 6Continuous improvement
CapstoneProduction-readiness review and hardeningReference implementation

Module 2 · Operating agents · Lesson 5

Observability and cost

Traces that show what an agent did and why it was slow or expensive, OpenTelemetry and eve Agent Runs in practice, and token, latency and cost budgets per case, with prompt caching and model routing worked through in numbers.

75 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodeNode.js, pnpm and TypeScriptDocker and Docker ComposeTrace LLM calls with OpenTelemetry and LangfuseDurable agents with eveGet an OpenRouter keyLocal models with Ollama

By the end of this lesson you can

  • Explain traces, spans and attributes, and map an agent run onto them using the OpenTelemetry GenAI conventions
  • Enable tracing in eve and the Claude Agent SDK, and control which content reaches each destination
  • Compute the cost of an agent run with and without prompt caching, and predict when caching stops helping
  • Set and enforce token, cost and latency budgets per session and per case
  • Use traces to find the step that dominates cost or latency, and choose between caching, routing and redesign

On this page

  • Intuition: the itemised bill
  • The mechanism: traces, spans, attributes
  • Instrumenting in practice
  • eve
  • Claude Agent SDK and Claude Code
  • Budgets: tokens, cost, latency
  • A worked example: what caching buys
  • Model routing
  • Video
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Intuition: the itemised bill
  2. 02The mechanism: traces, spans, attributes
  3. 03Instrumenting in practice
  4. 04Budgets: tokens, cost, latency
  5. 05A worked example: what caching buys
  6. 06Video
  7. 07Misconceptions and limits
  8. 08Connections
  9. 09Summary

Sources & further reading

  • Dapper, a Large-Scale Distributed Systems Tracing InfrastructureLab research · Sigelman, Barroso, Burrows, Stephenson, Plakal, Beaver, Jaspan, Shanbhag · Google · 2010The paper behind modern distributed tracing, including OpenTelemetry. Read sections 2 (the trace and span model) and 4 (sampling and overhead).
  • OpenTelemetry GenAI Semantic ConventionsDocs · OpenTelemetryThe standard names for GenAI spans and attributes (invoke_agent, execute_tool, gen_ai.usage.input_tokens, gen_ai.conversation.id). Status is Development, so names can still change. Start at docs/gen-ai.
  • eve OpenTelemetryDocs · Vercelotel() and otelIntegration(), trace policies, per-destination export policies and redaction, and how the capture policy also sets run-data retention.
  • eve Agent RunsDocs · VercelVercel's built-in trace destination for eve sessions (beta), sampling rules, and filtering exports.
  • Observability with OpenTelemetry (Agent SDK)Docs · AnthropicHow the SDK exports metrics, log events and traces via the Claude Code CLI, the environment variables that turn them on, and controlling sensitive data.
  • Track cost and usage (Agent SDK)Docs · AnthropicPer-step usage, total_cost_usd, and the warning that SDK costs are client-side estimates, not billing data.
  • Prompt cachingDocs · AnthropicCache write and read multipliers, the 5-minute default TTL and 1-hour option, and minimum cacheable lengths. The source for the worked example's multipliers.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 9 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks