Agents, lesson 10
Traces you can debug from
Record every step so a failed run can be explained.
You know the agent loop and the controls around it: retries ("When a tool call fails"), caps ("Knowing when to stop") and the tool gate ("Limits on what an agent may do").
Part 1. Why the final answer isn't enough
A customer was refunded $80 for a $40 order. The agent's final message says "Refunded the duplicate charge." Your server log has one line: refund issued: 80.00. Neither tells you why.
To find out, you need the whole run: what the model saw at each step, what it asked for, what came back. Laid out in order, it shows the cause at step 4. search_payments returned both the original charge and the duplicate, and the model added them up instead of picking one.
Your turn
Which record would have let you find that cause fastest?
Trace
The full record of one run: every model call, tool call, retry and decision, in order and nested, with timings, inputs and outputs. It's the main tool for debugging an agent.
Part 2. Spans inside spans
Keep going with Pro
You've done the first part. Pro opens the rest of this lesson, and every other one.
- Spans inside spans
- Reading a trace
- From one trace to a hundred
- What to keep, and what to leave out
Agents overviewSpotted a mistake? Tell us.