▶ Sign up free for the video, slides & prompts
The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.
Checking…
AI Agents in Production · Lesson 9 of 14 · 1 min read · 5 min video
Observability: traces, logs and cost per task
See every step, tool call and token, so you can debug and budget.
📄 Download slides (PDF)· free sign-upWhen a user says "the bot gave me a wrong answer", you need to see exactly what happened: every model call, tool call and decision. That's observability, and for agents it's not optional.
Traces
A trace is the full story of one task, made of spans, one per step:
- Each model call: prompt, response, model, tokens, time taken
- Each tool call: name, arguments, result, errors, time taken
- Guardrail checks, approvals and retries
Tools such as Langfuse, LangSmith, Arize Phoenix or plain OpenTelemetry show traces as a timeline, so you can click through a run step by step.
What to log on every task
Hash or remove personal details before logging. Logs are often kept longer and seen by more people than your main database.
Dashboards worth watching
- Success rate and the most common failure reasons
- Cost per task (average and the most expensive 1%)
- Latency: the typical time and the slowest 5% (p95)
- Steps per task: a sudden jump usually means the agent is stuck in loops
- Tool error rate, per tool
Close the loop
Turn bad traces into eval cases. Every production failure you fix should become a test, so it never comes back.
In one line
Trace every step of every task, log cost and outcome, watch a few key dashboards, and turn each failure into a new eval case.
Share with a friend