Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Context Engineer Associate

Pre-Inference vs Just-in-Time Retrieval

Databricks Context Engineer Associate · Lesson 8 of 18 · 53:22

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Context Engineer Associate exam. In this lesson: the context elements a task needs to be scoped and executed, pre-inference retrieval versus just-in-time retrieval with tool calls and Delta table queries, lightweight references, and hybrid strategies. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

An offer for the wrong unit

A leasing manager asks Thistledown's renewal agent to draft an offer for unit four B. The agent loads every market report it can find, and still quotes the current rent of another unit. This lesson covers the context elements a task needs, and the choice between retrieving before inference and retrieving just in time.

What a task needs

Before retrieving anything, list the context elements the task cannot do without. Who is asking, and what they are allowed to see. What the task is about: the exact lease, unit, or tenant, by ID. The data that bounds it, like the dates, the building, and the current rent, and the rules that apply, like the pricing policy. And the expected output, its format and its reader, while everything else stays out.

Pre-inference retrieval

Pre-inference retrieval runs before the model reasons: an embedding search finds relevant chunks, and loads them into the context up front. It is fast, with a single round trip, and its behavior is easy to predict. It suits stable reference content, like house rules, policies, and lease templates. But it struggles when data changes by the minute, or when the answer needs exact filters on structured data.

Just in time retrieval

Just in time, or agentic, retrieval lets the agent decide what to fetch while it works, with tool calls that query a Delta table, ask a Genie Agent, or search an index. The agent keeps lightweight references, like a lease ID or a stored query, and loads the data only when a step needs it. It is fresh and precise, but it adds calls and latency, and it depends on well designed tools. Many agents use a hybrid: a stable core loaded up front, and the rest fetched on demand.

Choosing a strategy

Choose by the nature of the information. Stable, text heavy, and general content suits pre-inference retrieval. Changing, structured, and specific data suits just in time tool calls, with the filters the task needs. Mixed tasks use both, and an evaluation tells you whether the extra calls are worth their latency.

Recap

Let's recap. A task needs who is asking, its exact scope, the data that bounds it, the rules, and the expected output. Pre-inference retrieval loads chunks up front, fast and predictable, for stable content. Just in time retrieval fetches data with tools while the agent works, fresh and precise. Many agents combine both, with a stable core and data on demand. And an evaluation tells you whether extra calls are worth their latency.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. The renewal offer for unit 4B quotes the rent of another unit. Which context element is most likely missing?

    • More market reports for the area
    • A larger, more capable model
    • The exact unit and lease IDs in scope
    • A smaller set of tools
    Show the answer

    The exact unit and lease IDs in scope

    The task's scope, the exact unit and lease IDs, so every lookup targets unit four B. “More market reports for the area” is wrong, since more market reports add noise, and still do not say which unit is meant. “A larger, more capable model” is wrong, since a larger model cannot guess the unit it was never given. And “A smaller set of tools” is wrong, since fewer tools would not tell the agent which unit to look up.

  2. A tenant asks for their current balance, which changes every day in a Delta table of payments. Which retrieval strategy fits?

    • A tool call that queries the payments table for this tenant
    • A nightly AI Search index of the whole ledger
    • The whole ledger in the system prompt
    • Similar past conversations from memory
    Show the answer

    A tool call that queries the payments table for this tenant

    A tool call that queries the payments table for this tenant, at the moment of the question, returns the exact current balance. “A nightly AI Search index of the whole ledger” is wrong, since a nightly index of the ledger would be stale, and imprecise for a single figure. “The whole ledger in the system prompt” is wrong, since the whole ledger in the prompt would waste attention, and expose other tenants' data. And “Similar past conversations from memory” is wrong, since similar past conversations hold old balances, not today's.

  3. The agent answers about building policies, which change twice a year, and needs each tenant’s open work orders, which change every hour. Which design fits?

    • Index policies and work orders together, nightly
    • Policies before inference, work orders by tool call
    • Load whole policy files through tool calls
    • Retrieve nothing, rely on the model’s knowledge
    Show the answer

    Policies before inference, work orders by tool call

    Retrieve the stable policies before inference, and fetch the open work orders with a tool call when needed. “Index policies and work orders together, nightly” is wrong, since an index of hourly work orders would often be stale. “Load whole policy files through tool calls” is wrong, since loading whole policy files through tools wastes tokens on content that rarely changes. And “Retrieve nothing, rely on the model’s knowledge” is wrong, since the model knows neither Thistledown's policies nor its work orders.