Where the time goes
What it is
Latency is how long something takes. For an agent task it is the sum of:
- model calls, each made of a time to first token (the wait before any output appears) plus generation time (output tokens ÷ tokens per second);
- tool calls: your systems' own response times;
- overhead: queue wait, loading and saving state, guardrail checks.
The steps of a loop run one after another, so their times add up.
Why it matters
Two facts shape every optimisation.
- Model time is driven mostly by output length and number of calls, much less by input length.
- Sequential steps multiply: six steps of three seconds is eighteen seconds, however fast each part is.
- So the big wins are fewer sequential steps, shorter outputs, and faster models for the steps that do not need a slow one.
- Measure two numbers: time to the first visible response, and time to completion. Users feel the first far more.
In the real world: A team profiled a 20-second task and found 14 seconds in six sequential model calls, 5 in tools and under half a second in their own code; the plan that followed touched no application logic.
Visual example
BreakdownA model call producing 150 output tokens, then a tool taking 500 ms.
Optimising your own code. In a typical trace, model and tool waits are over 95 percent of the time. Shaving milliseconds from the loop changes nothing a user can feel.