← Table of Contents · Page 290 of 868

TRACING AND SPANS

Part 4 of 10

READING A TRACE TO FIND A PROBLEM When a run goes wrong, read its trace from the top. First check the status of the top span, then scan the child spans for errors and for unusually long bars. Look at the order of events, because a surprising order often points to a bad decision by the model. Open the span just before the first sign of trouble and read its inputs, since that is usually where the cause hides. Practice on a small trace until the habit becomes quick, and you will find that most problems announce themselves within a minute or two. SPANS IN THE PRACTICE LAB In Chapter 68 you will add tracing to the Resume Review Agent. Each resume run will become one trace, and inside it each model call and each tool call will become a span with a start time, an end time, and the tool name. After a run, you will open the trace file and find the slowest span. This small exercise shows how quickly a trace turns a vague feeling that the agent is slow into a precise statement such as "the file-reading tool takes most of the time."
Advertisement
Read Aloud:
0:00 / 0:00