CertSafari
    Databricks Certified Generative AI Engineer Associate· Lessons

    Domain 1 · Lesson 5/56

    Defining and ordering agent tools for multi-stage reasoning

    Define and order tools that gather knowledge or take actions for multi-stage reasoning

    18 min read
    2.33% of exam
    7 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Choose between a deterministic chain, a single agent and a multi-agent supervisor based on who should decide tool order
    • Trace how the tool-calling loop produces a multi-stage sequence of calls
    • Match each knowledge source or action to a retriever tool, Unity Catalog function, Genie/SQL tool or external connection
    • Write tool names and descriptions that steer the LLM into the right call order, and gate risky action tools

    Key concept

    Tool order ownership — In every agent design, someone decides which tool runs next. In a deterministic chain that is the developer, writing it in code. In a single agent it is the LLM, deciding again on each turn of the tool-calling loop. In a multi-agent system it is a supervisor that routes the request to a specialist. Pick the design by choosing who should own that decision.

    1.Who decides the order: chain, single agent or supervisor

    Multi-stage reasoning means answering a request by chaining several steps that gather knowledge or take action. A call-center agent asked to return an order has to look up the order, read the return policy, check the return window, trigger the return and only then reply. Each of those steps is either a tool call or the LLM reasoning over what the tools returned. The first design decision is who puts those steps in order.

    In a deterministic chain, the developer writes the order into code. A basic RAG chain always retrieves the top-k results, adds them to the prompt and generates. The LLM never picks a tool. This makes the chain the most predictable and auditable design, and usually the fastest, because no extra LLM calls are spent on orchestration. The cost is rigidity: a request the chain did not anticipate needs a code change.

    In a single-agent system, one LLM chooses the order at runtime. It decides whether to call a tool, which one, whether to call again, and when to stop. A help desk agent can answer a policy question directly, then call lookup_order(customer_id, order_id) for the next user. If that call returns "invalid order number", the agent can retry or ask the user for the correct ID. That flexibility makes a single agent the usual default for enterprise work in one domain. The trade-off is that you have to guard against repeated or incorrect tool calls.

    In a multi-agent system, a supervisor routes the request and each specialist orders its own tools. The coordinator can be another LLM or a rule-based router. Three signs point to this design: the domains are distinct, each specialist needs its own prompts and context, or there are so many tools that one agent's schema cannot reasonably hold them all. A single agent asked to cover finance, devops and marketing tends to become overloaded. The cost is harder routing, tracing and debugging. Agents can also pass a task back and forth without resolving it.

    Who decides tool order in each design, and what that buys or costs
    PatternWho decides tool orderWins whenMain cost
    Deterministic chainThe developer, in code, for every requestWell-defined tasks where consistency, auditing and low latency come firstInflexible; new capabilities need code changes
    Single-agent systemOne LLM, on each turn of the loopVaried queries within one cohesive domainLess predictable; must guard against repeated or incorrect tool calls
    Multi-agent systemA coordinator or supervisor routes to specialists, and each specialist orders its own toolsLarge or cross-functional domains with distinct tool setsComplex to orchestrate; harder to trace and debug

    Start with the simplest design that works, and add autonomy only when the requirements call for more flexibility or model-driven decisions. Separate agents that each sit behind their own endpoint, with no coordinator, are not a multi-agent system. They push the routing decision onto the user.

    If you already have specialist agents, such as a Genie Agent and a Knowledge Assistant, you may not need to write a coordinator. The Agent Bricks Supervisor Agent can reference them as subagents, and it respects each user's existing permissions. When to use it is covered in Agent Bricks Supervisor Agent. For ordering, the relevant fact is that its routing is permission-aware out of the box. Users reach only the subagents and data they are already allowed to access, so you never weaken permissions to make the routing work.

    Checkpoint 1 of 9· Match them up

    Match each agent design to who decides the order in which tools run

    Tap a term, then the definition that fits it.

    Checkpoint 2 of 9· Exam question

    A team supports three very different request types through one chat entry point: HR policy questions, IT ticket creation, and sales forecast lookups, each needing its own distinct set of tools. Which design best fits this multi-stage reasoning scenario?

    Checkpoint 3 of 9· Exam question

    A team already has a working sales Genie Agent and a knowledge assistant, and wants to combine them behind one conversational entry point while preserving each user's existing per-agent permissions, with minimal custom orchestration code. What should they do?

    Sources12

    2.The tool-calling loop that produces the sequence

    The tool-calling loop is how a multi-stage order happens. The model gets the messages and the tool definitions. If it answers in plain text, the loop ends. If it asks for a tool, the runtime runs that tool, adds the result to the messages and calls the model again. The model therefore chooses the second tool after it has seen what the first one returned. A customer ID found in step one can become an argument in step two.

    A tool-calling loop for a Unity Catalog function: stop when the model asks for no more tools, otherwise run the calls and loop. The loop is capped at ten iterationspython
    for _ in range(10):
        response = model_client.chat.completions.create(
            model=os.environ["OPENAI_MODEL"],
            messages=messages,
            tools=toolkit.tools,
        )
        if not response.choices[0].message.tool_calls:
            print(response.choices[0].message.content)
            break
        messages.extend(generate_tool_call_messages(response=response, client=client))
    else:
        raise RuntimeError("The agent reached the tool-calling limit.")

    The range(10) is part of the design, not a leftover. Any tool-calling setup can loop forever, for example by retrying a lookup that keeps failing. An iteration limit or a timeout turns that into an error you can see instead of a stuck request. Prebuilt runners such as LangGraph's create_react_agent run the same loop for you: you pass the model and the tools, and the framework handles propose, run, append and decide.

    Checkpoint 4 of 9· Check yourself

    A teammate wants to replace for _ in range(10): with while True:. Their reason is that the tool descriptions are now clear, so the model will reliably reach a final answer. What is wrong with this change?

    Sources31

    3.Matching each knowledge source or action to a tool type

    Each piece of knowledge or action the pipeline needs becomes a defined tool, and each tool gets a place in the reasoning sequence. Working out what the pipeline has to fetch belongs to identifying the data the pipeline must fetch. This step turns each item on that list into the right kind of tool. The deciding questions are what shape the data has and who writes the query.

    Choosing a tool type for each source or action
    NeedTool typeWhy this one
    Search documents, knowledge bases or text corporaRetriever tool (VectorSearchRetrieverTool over an AI Search index)Exposes an index as a tool, with a description that tells the agent when to search
    Run a known query whose parameters the agent suppliesUnity Catalog functionThe logic is predefined; the agent only fills in the parameters
    Answer business questions across the workspace in natural languageGenie One MCPInterprets business terms and queries with the caller's permissions
    Query one curated Genie Agent from PythonAI Bridge tools (GenieAgent / Genie client)Handles requests, polling and results through the Genie API
    Write and run arbitrary SQL against Unity Catalog tablesDatabricks SQL MCPThe agent writes the SQL itself
    Run Python, SQL or shell codesystem.ai.sandbox MCPIsolated environment with no network egress
    Reach a vector store or service outside DatabricksUnity Catalog HTTP connection used in agent codeConnects to the external service without embedding credentials in the agent
    Act in SaaS tools such as Slack or GitHubBuilt-in system.ai MCP ServicesReady-made servers for third-party tools

    Genie and MCP are the two names that recur in that list. Genie is the Databricks feature that lets business users query structured data, such as Delta tables and views, in natural language. It reads Unity Catalog metadata (table descriptions, column names, key relationships) to construct the SQL for each question, which is why Genie tools generate queries rather than run fixed ones. A Genie Agent is one such curated space of tables, and a Genie conversation is the thread of questions asked within it. MCP servers are the other recurring piece: a server exposes a set of tools behind one common interface, and agent code connects to it by URL. Databricks-managed servers, external MCP Services and custom servers all look the same to the agent, so only the URL and authentication differ.

    Three of the tool types are easy to mistake for products rather than mechanisms. An AI Search index stores documents as embedding vectors, so a query returns the passages closest in meaning; VectorSearchRetrieverTool wraps an index so the agent can call it. AI Bridge is the set of Python libraries, such as databricks-ai-bridge, that wrap Genie Agents and indexes as agent tools. A Unity Catalog HTTP connection is a stored definition of an outside service's host and credentials, created with CREATE CONNECTION and TYPE HTTP. Agent code calls the service through it, and the caller needs USE CONNECTION on it.

    For structured data, the deciding question is who writes the query. If you know the query ahead of time, such as "look up a customer by name", a Unity Catalog function keeps the SQL fixed and lets the agent pass in the name. If the questions are open-ended, such as "top 10 customers by revenue last quarter", a Genie tool or the SQL MCP lets the query be generated. A fixed function is easier to audit. A generated query covers questions you did not foresee.

    The type you choose also limits where the tool can sit in the sequence. A sandboxed code tool has no network egress, so it cannot download packages or call APIs. A Genie tool starts a new conversation on every call unless you save the conversation ID and pass it on the next call. Without that ID, a follow-up step loses the context of the previous one. With MCP servers, do not hardcode tool names or argument shapes. List the server's tools from code to confirm each tool's name, description and input schema at runtime.

    Checkpoint 5 of 9· Check yourself

    Compliance requires every SQL statement your agent runs against the customer table to be reviewed before release. The agent only ever needs to fetch a customer's email and ID from the customer's name. Which tool type fits this need?

    Checkpoint 6 of 9· Check yourself

    In step one, an agent calls its ask_genie tool with "What were total sales last month?" In step two, it calls the same tool with "Break that down by region." The second answer ignores the first. What is the most likely cause?

    Sources45673

    4.Names and descriptions steer the order, and gates enforce it

    The LLM chooses its next tool from the tool's name, description and parameter docs, and from nothing else. On a retriever, tool_name and tool_description exist for this purpose. A description such as "Search Databricks documentation to answer product questions" tells the agent when to search. If every tool has a vague description, the model has no basis for choosing one over another, and the order becomes guesswork.

    A description can also encode a dependency between tools. The comment on the Unity Catalog function below says what goes in and what comes out, and adds that the returned ID feeds other queries. A model that needs order history but only has a customer name now has a reason to call this tool first and carry the ID into the next call. The parameter comment does the same job for the input.

    A Unity Catalog SQL function whose COMMENT tells the agent its output feeds later callssql
    CREATE FUNCTION my_catalog.my_schema.lookup_customer_info(
      customer_name_input STRING COMMENT 'Name of the customer whose info to look up'
    )
    RETURNS STRING
    COMMENT 'Returns metadata about a particular customer, given the customer''s name, including the customer''s email and ID. The
    customer ID can be used for other queries.'
    RETURN SELECT CONCAT(
        'Customer ID: ', customer_id, ', ',
        'Customer Email: ', customer_email
      )
      FROM my_catalog.my_schema.customer_data
      WHERE customer_name = customer_name_input
      LIMIT 1;

    Good descriptions steer the model, but they cannot guarantee anything. A single agent's order is less predictable than a chain's, and it can still make an incorrect tool call. For gathering tools, a wrong order costs an extra round trip. For action tools, such as triggering a return or issuing a payment, a wrong order produces an outcome you cannot take back. Production systems therefore limit the agent's autonomy on risky actions. One way is to require human approval before the action runs. Another is to build the precondition into the action tool itself, so it refuses to run until the verification step has passed.

    The call-center example shows the intended order: find information, reason about whether the order is inside the return window, escalate to a human if it falls outside the normal rules, then act. Verification comes before the action. Running the action first and the checks afterwards only produces an audit trail of a mistake. So does removing the check and relying on a reviewer after a payment has settled. Running the check and the action in parallel to save time means the action never waits for the check's verdict.

    Checkpoint 7 of 9· Fill the gap

    Which keyword gives this Unity Catalog function the text the agent reads to decide when to call it, and that the returned ID can feed later calls?

    CREATE FUNCTION my_catalog.my_schema.lookup_customer_info(
      customer_name_input STRING COMMENT 'Name of the customer whose info to look up'
    )
    RETURNS STRING
     ?  'Returns metadata about a particular customer, given the customer''s name, including the customer''s email and ID. The
    customer ID can be used for other queries.'
    RETURN SELECT CONCAT(
        'Customer ID: ', customer_id, ', ',
        'Customer Email: ', customer_email
      )
      FROM my_catalog.my_schema.customer_data
      WHERE customer_name = customer_name_input
      LIMIT 1;

    Checkpoint 8 of 9· Check yourself

    An agent has two tools, check_return_window and issue_refund. A refund must never be issued for an order outside the return window. Which design meets this requirement?

    Checkpoint 9 of 9· Exam question

    A generative AI engineer is building a tool-calling agent for a claims-processing use case. The agent has three tools: lookup_claim_details, check_policy_coverage, and issue_payment. Payments must never be issued for claims that fail coverage verification. How should the engineer define and order these tools for the agent's multi-stage reasoning loop?

    Sources71

    Sources

    (7)

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

    1. 1.
      “the developer defines which tools or models are called, in what order, and with which parameters.”
      ↩︎ Who decides the order: chain, single agent or supervisor
      “If that tool responds with "invalid order number," the agent can retry or prompt the user for the correct ID”
      ↩︎ Who decides the order: chain, single agent or supervisor
      “A separate "coordinator" or "AI supervisor" directs requests to the appropriate agent, or decides when to hand off from one agent to another.”
      ↩︎ Who decides the order: chain, single agent or supervisor
      “If your application spans radically different sub-domains (finance, devops, marketing, etc.), a single agent can become unwieldy or overloaded with functionality requirements.”
      ↩︎ Who decides the order: chain, single agent or supervisor
      “start simple. Introduce more complex agentic behaviors when you truly need them for better flexibility or model-driven decisions.”
      ↩︎ Who decides the order: chain, single agent or supervisor
      “Infinite loops can occur in any tool-calling scenario, so set iteration limits or timeouts.”
      ↩︎ The tool-calling loop that produces the sequence
      “most production systems carefully constrain the agent's autonomy to ensure compliance and predictability, for example by requiring human approval for risky actions.”
      ↩︎ Names and descriptions steer the order, and gates enforce it
      “Reason: The agent checks whether that order fits in the return window.”
      ↩︎ Names and descriptions steer the order, and gates enforce it
      “The LLM adaptively decides which tools to use, when to make more LLM calls, and when to stop.”
      ↩︎ Key concept
      “You have so many tools that fitting them all into one agent's schema is impractical; each agent can own a subset.”
      ↩︎ Exam trap 1
      “Infinite loops can occur in any tool-calling scenario, so set iteration limits or timeouts.”
      ↩︎ Exam trap 3
      “most production systems carefully constrain the agent's autonomy to ensure compliance and predictability, for example by requiring human approval for risky actions.”
      ↩︎ Exam trap 4
      “the developer defines which tools or models are called, in what order, and with which parameters”
      ↩︎ Checkpoint
    2. 2.
      “The supervisor has built-in access controls, so that its end users only access the subagents and data they have access to.”
      ↩︎ Who decides the order: chain, single agent or supervisor
      “The supervisor has built-in access controls, so that its end users only access the subagents and data they have access to.”
      ↩︎ Exam trap 2
    3. 3.
      “The helper runs the requested functions and formats their results for the next model call.”
      ↩︎ The tool-calling loop that produces the sequence
      “Use Unity Catalog functions when your agent needs to run predefined logic, such as a SQL query whose parameters the agent supplies.”
      ↩︎ Matching each knowledge source or action to a tool type
    4. 4.
      “Create a structured retrieval tool using Unity Catalog SQL functions when the query is known ahead of time and the agent provides the parameters.”
      ↩︎ Matching each knowledge source or action to a tool type
      “Databricks recommends the Genie One MCP for agents that answer business questions across the workspace in natural language.”
      ↩︎ Matching each knowledge source or action to a tool type
      “Use the Databricks SQL MCP when your agent needs to write and run SQL against your Unity Catalog tables.”
      ↩︎ Matching each knowledge source or action to a tool type
      “AI Bridge handles requests, polling, and query results through the Genie API.”
      ↩︎ Matching each knowledge source or action to a tool type
      “These examples start a new Genie conversation for each tool call. To retain context, save the returned conversation ID”
      ↩︎ Checkpoint
    5. 5.
      “is designed to make structured data such as Delta tables and views directly accessible to business users by leveraging natural language interfaces”
      ↩︎ Matching each knowledge source or action to a tool type
    6. 6.
      “All of them expose the same MCP interface, so the agent code is the same.”
      ↩︎ Matching each knowledge source or action to a tool type
      “built-in system.ai MCP Services for third-party SaaS tools such as Slack, GitHub, Google Drive”
      ↩︎ Matching each knowledge source or action to a tool type
      “call list_tools() to get each tool's name, description, and input schema at runtime”
      ↩︎ Matching each knowledge source or action to a tool type
    7. 7.
      “Use VectorSearchRetrieverTool from databricks-langchain or databricks-openai to expose an index as an agent tool.”
      ↩︎ Matching each knowledge source or action to a tool type
      “If your vector index is hosted outside Databricks, you can create a Unity Catalog connection to connect to the external service”
      ↩︎ Matching each knowledge source or action to a tool type
      “Create a retriever tool and give it a description that tells the agent when to search.”
      ↩︎ Names and descriptions steer the order, and gates enforce it
      “# Used by the LLM to understand the purpose of the tool”
      ↩︎ Names and descriptions steer the order, and gates enforce it

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