TL;DR: Measure before changing anything: per-step tokens, time and outcome from traces, on a fixed task set. Then work down the ladder: remove steps that never change the outcome, trim what tools return and what history is re-read, fix tool descriptions that cause repeated or wrong calls, cache the stable prefix, parallelise independent calls, and route easy steps to a smaller model with escalation. Accept each change only if success and reliability hold on the same tasks.
How to approach it
Treat it as a performance investigation: profile, find the dominant cost, fix it, re-measure. Say explicitly what you will not do first (change the model or fine-tune) and why.
A strong answer
Profile. From traces of, say, 100 representative tasks: steps per task, input and output tokens per step, time per step split into model, tool and harness, and the outcome. Long-run cost is dominated by input tokens because each step re-reads the history; latency is dominated by sequential model calls and slow tools.
Cut steps. Look for steps whose result never changes the outcome (a "double-check" call, a repeated search) and for fixed sequences the model rediscovers each time. Turn fixed parts into code; stop on a verified result.
Cut context. Trim tool results to the fields the next decision needs, clear stale results, compact long histories, move exploration into a subagent.
Fix tools. Repeated calls usually mean the result was ambiguous or truncated, or the error said nothing actionable. Sharpen descriptions and results; reduce the tools offered per task.
Cache, parallelise, route.
- Keep the prompt prefix byte-identical so caching applies.
- Run independent tool calls in parallel; latency becomes the slowest call, not the sum.
- Route classification and extraction steps to a smaller model behind a check, escalating uncertain cases.
steps = [("plan", 2.1), ("search", 4.0), ("search", 4.2), ("lookup_order", 1.1),
("lookup_shipping", 1.3), ("decide", 2.4), ("verify", 2.0), ("reply", 1.6)]
baseline = sum(t for _, t in steps)
deduped = baseline - 4.2 # the repeated search
parallel = deduped - min(1.1, 1.3) # two independent lookups at once
dropped = parallel - 2.0 # verify never changed an outcome
print(round(baseline, 1), round(dropped, 1))
# => 18.7 11.4
Three structural changes cut this trace's time by about 40% with the same model. The same changes cut tokens, because every removed step also removes a history re-read.
Only then the model. If cost is still too high, measure a smaller model or a router on the remaining steps against the same tasks; fine-tuning comes after that, for a stable, narrow step with a trusted grader.
Guard quality. Every change is accepted on success rate, pass^k and a hard slice of important tasks, not on cost alone.
What interviewers probe next
"What if the 90 seconds are mostly one slow tool?" Then the agent is not the problem: cache that tool's results, call it asynchronously, or change what is fetched.
"Would you stream the answer?" Streaming improves perceived latency for the user but not cost or completion time; do it in addition, not instead.
How it's scored
Weak: Switches to a cheaper model or fine-tunes first.
Hire: Profiles with traces, trims context and steps, adds caching.
Strong Hire: Profiles per step, works the ladder in order (steps, context, tools, caching, parallelism, routing, then weights), quantifies each change, protects quality with pass^k and a hard slice, and distinguishes perceived from actual latency.
Common mistakes
- Optimising without a baseline on fixed tasks.
- Reporting cost savings without the success rate.
- Ignoring input tokens re-read every step.