CertSafari
    Databricks Certified Context Engineer Associate· Lessons

    Domain 7 · Lesson 45/45

    Choosing a Replacement Long-Horizon Strategy

    Given a long-running Databricks agent task with documented performance failures, identify which long-horizon strategy mismatch is causing the observed failure, select the replacement strategy most appropriate for the task's dependency structure, and justify the selection by identifying the specific characteristic that makes the original strategy insufficient.

    11 min read
    2.17% of exam
    6 sources
    Published 3 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Read what each step of a long task depends on and pick the Databricks strategy that keeps that dependency
    • Justify a replacement by naming the specific characteristic that makes the original strategy insufficient
    • Enable and drive Supervisor Agent task continuation correctly over the streaming API

    1.Read what each step depends on

    To choose a replacement strategy, ask one question about the task: what does the next step need in order to run? The documentation does not use "dependency structure" as a formal term. The dependencies it does describe line up cleanly with the available strategies.

    If the next step depends on the exact earlier steps of the same interaction, the agent needs its ordered transcript. A managed session keeps that. Its service keeps "a deterministic order for a session's items," and items cannot be changed once appended. That is what an agent replays to continue where it was.

    If the next step depends on facts from earlier, unrelated conversations, an ordered transcript is the wrong tool. Managed memory stores durable entries for an actor and returns the most relevant ones by search. The overview page describes this as semantic search. The managed memory page specifies that search ranks entries with a full-text (BM25) relevance score. Either way, the result is a set of relevant pieces ranked by relevance, not a replayable history.

    Both stores are backed by Lakebase, but the shared backing does not make them interchangeable. What separates them is scope: a session belongs to one interaction, and memory belongs to a subject across conversations.

    If the next step depends only on the previous step finishing, inside one long request, the problem is time, and Supervisor Agent long-running task mode is the replacement.

    If the steps never vary, so the next step is always known in advance, a dynamic agent may be the mismatch. In a deterministic chain, "The LLM does not make decisions about which tools to call or in what order." The design-patterns guidance recommends chains "For well-defined tasks with predictable workflows." A single dynamic agent, by contrast, "Must guard against repeated or incorrect tool calls."

    If the work splits into separable pieces that do not need each other's results, such as distinct problem areas or skill sets, one agent carrying everything can become unwieldy. The design-patterns guidance points to a multi-agent system when "You have distinct problem areas or skill sets such as a coding agent or a finance agent." Each agent has its own domain, context and tool set, so one piece does not have to share a single agent's context with the others. The harness guidance also notes that sandboxes make it possible to run many agents in parallel at scale. The sources do not quantify a throughput benefit, and they list the cost: multi-agent systems are harder to orchestrate, trace and debug.

    What the next step depends on → strategy that keeps it
    Next step depends onStrategyWhy it fits
    Prior steps of this same interaction, in orderManaged agent sessionsOrdered, immutable items replayed to continue the interaction
    Facts or decisions from separate, earlier conversationsManaged agent memorySubject-scoped entries retrieved by search across conversations
    Previous step finishing, within one long requestLong-running task modeSplits the run into request/response cycles at step boundaries
    A fixed, known-in-advance sequenceDeterministic chainDeveloper fixes tools and order; no on-the-fly decisions
    Separable pieces in distinct problem areas, not needing each other's resultsMulti-agent systemEach specialized agent owns its own domain, context and tools

    Checkpoint 1 of 5· Exam question

    A single agent processes 50 unrelated documents one at a time in a sequential loop: summarize document 1, then document 2, and so on, where no document's summary depends on any other document's content or result. Throughput is far below what the underlying compute could support. What characteristic of this task makes the sequential single-agent loop an insufficient long-horizon strategy?

    Sources12345

    2.Justify the switch: name what the original cannot do

    Saying "use X instead" is not a full answer. The justification has to name the specific characteristic that makes the original strategy insufficient for this task. Each case below pairs a documented failure with that characteristic.

    Checkpoint 2 of 5· Check yourself

    A dynamic single agent runs a nightly report job whose steps never change: retrieve, augment, generate. Failure reports show occasional repeated and incorrect tool calls. Which replacement does the guidance support, and why?

    Checkpoint 3 of 5· Exam question

    Which Databricks capability is typically used to give a long-horizon agent durable, resumable state that survives across steps or sessions?

    Sources3654

    3.Applying the continuation replacement correctly

    When the diagnosis is many steps adding up past the API timeout, switching to task continuation is the right choice. It can still fail if it is wired up wrong. In AI Playground, continuation is automatic: Playground sends the continuation response for you, and you see one uninterrupted conversation. A client that calls the streaming API directly has to do this work itself. It must detect task_continue_request events and send a follow-up request.

    Note that the documentation shows the initial request with an input field and the follow-up example with a messages field. This lesson reproduces both shapes as the page gives them. Use the page's own examples as the reference for the exact field names.

    Checkpoint 4 of 5· Fill the gap

    Which option in databricks_options turns on long-running task mode?

    {
      "input": [{ "role": "user", "content": "Your message here" }],
      "databricks_options": {
        " ? ": true
      },
      "stream": true
    }

    The follow-up request carries the earlier messages, the original task_continue_request, and a task_continue_response whose continue_request_id echoes that request's id. It sets "long_task": true again. A client that works in Playground but stalls in production has usually missed this detect-and-respond step.

    Checkpoint 5 of 5· Check yourself

    A custom app calls a Supervisor Agent over the streaming API with long_task enabled. The same task completes in AI Playground, but in the app it stops after the first task_continue_request. What is the most likely cause?

    Sources6

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Managed agent memory can stand in for session history when an agent has to resume a run.Why is that wrong?

      Memory search returns the most relevant entries ranked by relevance score, not an ordered transcript. Resuming one interaction depends on the ordered items that a managed session keeps.

      Covered in Read what each step depends on

    2. 2.Because continuation works seamlessly in AI Playground, a direct API client gets the same behaviour just by setting long_task.Why is that wrong?

      Playground sends the continuation response for you. A direct streaming client must detect task_continue_request and send the follow-up request itself.

      Covered in Applying the continuation replacement correctly

    Practise it for real

    Drive a Supervisor Agent long-running task over the streaming API, handling continuation yourself instead of relying on Playground

    1. 1.Send a streaming request to your Supervisor Agent endpoint with a multi-tool task in input and "databricks_options": {"long_task": true}, plus "stream": true

      Why: Long-running task mode is opt-in per request

      You should see: The supervisor starts calling tools and streaming output

    2. 2.Watch the stream for a response.output_item.done event whose item.type is task_continue_request, and record its id and step

      Why: This event marks the checkpoint where the supervisor paused before the timeout

      You should see: An item like {"type": "task_continue_request", "id": "continue_<unique-id>", "step": 16}

    3. 3.Send a follow-up request shaped like the documentation's continuation example: the earlier messages, the original task_continue_request, and a task_continue_response with continue_request_id set to the recorded id, keeping long_task true

      Why: The continue_request_id must match the id from the task_continue_request

      You should see: The supervisor picks up where it left off and keeps working

    4. 4.Repeat the detect-and-respond loop until no further task_continue_request appears, comparing the step value at each checkpoint

      Why: step reports the total tool-call steps completed so far, so it shows progress across cycles

      You should see: The task completes after one or more continuation cycles

    Stuck? Get a nudge

    If a request still times out with no continuation event, look for one tool or model call that runs past the timeout by itself. Continuation cannot checkpoint inside a single step.

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “The service maintains a deterministic order for a session's items”
      ↩︎ Read what each step depends on
      “Items are immutable after they are appended.”
      ↩︎ Read what each step depends on
    2. 2.
      “Search returns the most relevant entries ranked by a full-text (BM25) relevance score.”
      ↩︎ Read what each step depends on
      “Search returns the most relevant entries ranked by a full-text (BM25) relevance score.”
      ↩︎ Exam trap 1
    3. 3.
      “retrieved by semantic search”
      ↩︎ Read what each step depends on
      “As a session accumulates, an agent (or your application) distills the durable facts out of it and writes them to memory.”
      ↩︎ Justify the switch: name what the original cannot do
      “Persist and resume an agent's session state so an interaction survives restarts”
      ↩︎ Prediction
    4. 4.
      “For well-defined tasks with predictable workflows.”
      ↩︎ Read what each step depends on
      “Must guard against repeated or incorrect tool calls”
      ↩︎ Read what each step depends on
      “You have distinct problem areas or skill sets such as a coding agent or a finance agent.”
      ↩︎ Read what each step depends on
      “Infinite loops can occur in any tool-calling scenario, so set iteration limits or timeouts.”
      ↩︎ Justify the switch: name what the original cannot do
      “The LLM does not make decisions about which tools to call or in what order.”
      ↩︎ Checkpoint
    5. 5.
      “They also make it possible to run many agents in parallel at scale.”
      ↩︎ Read what each step depends on
      “repeatedly attempting work, checking results, catching errors and correcting course automatically.”
      ↩︎ Justify the switch: name what the original cannot do
    6. 6.
      “Full long-running agent support, including timeouts during individual tool calls or model calls, is not yet available.”
      ↩︎ Justify the switch: name what the original cannot do
      “The continue_request_id must match the id from the task_continue_request.”
      ↩︎ Applying the continuation replacement correctly
      “In AI Playground, Playground automatically handles task continuation.”
      ↩︎ Applying the continuation replacement correctly
      “In AI Playground, Playground automatically handles task continuation.”
      ↩︎ Exam trap 2
      “When using the streaming API directly, your application must detect task_continue_request events and send a follow-up request to continue the task.”
      ↩︎ Checkpoint

    Ready to test yourself?

    Practise Databricks Certified Context Engineer Associate in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.