Skip to content

Lesson 3 of 5 · 3 min read

Agent Economics: Prefill, Caching and Routing

From the agent builder's side, a run's cost and latency come from four places: input processing (the whole context is read every turn, so it grows with the square of the turn count), output generation (slower per token but usually far fewer tokens), tool time and output generation (which together usually dominate wall-clock), and orchestration overhead. The levers follow: shrink what is resent (clearing, trimming tool results), cache stable prefixes, route routine steps to smaller or faster models, run independent tool calls in parallel, and cap turns. Measuring per step, from traces, shows which lever matters for a given agent.

Premium lessonReviewed By the AIAgentInterviews editorial team
Get full Premium access · $25

All 19 topics with every worked answer, all lessons and courses, the full practice bank, and anything new that appears during your access.

6 months · One payment · No auto-renewal

Practise it as an interviewer asks it

Course lessons that teach this

Related lessons