Lesson 5 of 6 · 3 min read
Just-in-Time Retrieval
Instead of loading everything an agent might need into every request, just-in-time retrieval gives it lightweight handles (file paths, record ids, document titles with sizes and dates) and tools to open exactly the slice it needs when it needs it. The trade is a few extra turns of latency against a much smaller, cleaner context. Good designs keep a small always-present core, give the agent a map of what exists, return slices rather than whole documents, and treat everything fetched as untrusted input.
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
What is context engineering, and why does an agent need it when the model already has a 200k-token window?What does an agent task cost? Show where the tokens, the seconds and the money go in one run, and what you would cut first.Your agent has a 200k-token window and falls apart at 55k. Why, and what do you change?Memory, context and retrieval: draw the difference for an assistant used for months.When does a second agent pay for itself?Find the right code in a two-million-line monorepo without flooding the context.