पाठ 20 / 26
Preview Runs and Traces
See every step a run took.
Read the trace, not only the answer
Builders provide a preview mode to run the workflow with test inputs, and record traces: each node, the prompts sent, model outputs, tool calls and their results, guardrail decisions and timings. When an answer is wrong, the trace shows where: wrong branch, bad tool parameters, missing state, or a model misreading context. Keep a set of saved test inputs (normal, edge, adversarial) and re-run them after every change. The Agents SDK also records traces for code-based agents.
Preview, measure, publish, embed
Treat a workflow like software: test it, measure it, version it and deploy it deliberately.
What to check in a trace
A debugging checklist.
1. which branch did each if/else take, and why (state values)?
2. what exact prompt did each agent receive (variables rendered?)
3. which tools were called, with which parameters and results?
4. did any guardrail trigger or nearly trigger?
5. how many loop iterations and total tokens?
6. which node took the most time?Save failing traces as tests
Every bug found in a trace becomes a saved input you re-run before each publish.
त्वरित जाँच: What does a trace show that the final answer does not?
- Only the final text
- The path, prompts, tool calls and timings of each step
- The model's weights
- The user's password
Answer
The path, prompts, tool calls and timings of each step — Traces locate failures.