Handoffs and guardrails
Agentic AI Foundations · Lesson 11 of 20 · 1:08:48
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.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Oracle Agentic AI Foundations Associate exam (1Z0-1157-26). In this lesson: handoffs from a triage agent to specialists, agents used as tools by a manager agent, input, output, and tool guardrails with their tripwires, and a complete customer support agent. Includes three original practice questions, with Fairhaven Furniture, a fictional furniture seller, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
From one agent to a team
Fairhaven's support agent now handles orders, deliveries, and returns, and its instructions keep growing. The team wants specialists instead: one for deliveries, one for returns, each with its own instructions and tools. They also want to stop off-topic requests, and to check the answers before customers see them.
Handoffs
A handoff passes control from one agent to another. A triage agent lists its specialists in handoffs, and each specialist can have a handoff description, which tells the model when to choose it. To the model, each handoff looks like a tool, named transfer to, followed by the agent's name. When the model calls it, the runner switches agents, and the specialist takes over the conversation, with the full history. Then the specialist answers the customer directly.
Agents as tools
With agents as tools, a manager agent keeps control instead. It calls specialist agents through as_tool, like any other tool, gets their results back, and writes the final answer itself. Choose it when a specialist should help with one subtask, without taking over the conversation. And you can combine both patterns: a specialist reached by a handoff can still call other agents as tools.
Three kinds of guardrails
Guardrails are checks that run alongside your agents. An input guardrail checks the user's request, and runs only for the first agent of a run. An output guardrail checks the final answer, and runs only for the last agent. And a tool guardrail wraps a function tool, and checks every call to it, before or after it runs, whichever agent makes the call.
Tripwires
A guardrail function returns a result with a tripwire. When the tripwire is triggered, the runner raises an exception, like InputGuardrailTripwireTriggered, and stops the run, so your code can answer the user politely. A guardrail can itself run a small, fast agent, for example to decide whether a question is about furniture at all. By default, an input guardrail runs in parallel with the agent, which is fast, but the agent may already have used tokens or run tools when the tripwire fires. Set run_in_parallel to False, and the guardrail finishes before the agent starts, so a blocked request never reaches the model.
A complete support agent
Put together, Fairhaven's support system looks like this. A triage agent, behind a blocking input guardrail that rejects off-topic requests, hands off to the delivery agent or to the returns agent. Each specialist has its own instructions and function tools, like delivery slots or return labels, and the returns agent checks every store credit with a tool guardrail. An output guardrail on each specialist checks that no answer reveals another customer's data. And tracing shows the whole path of every conversation: guardrail, handoff, tool calls, and answer.
Recap
Let's recap. A handoff passes control to a specialist, which appears to the model as a transfer tool, and the specialist answers with the full history. With agents as tools, a manager keeps control, and calls specialists through as_tool. Input guardrails check the request for the first agent, output guardrails check the final answer for the last agent, and tool guardrails check every call to a function tool. A triggered tripwire raises an exception and stops the run, and a blocking input guardrail stops a request before the agent starts.
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.
Fairhaven’s triage agent lists the returns agent in its handoffs. To the triage agent’s model, how does this handoff appear?
- As a guardrail on the returns agent
- As a tool: transfer_to_returns_agent
- As new instructions for the triage agent
- As a separate run that starts from zero
Show the answer
As a tool: transfer_to_returns_agent
Handoffs are represented as tools, and the default name is transfer to, followed by the agent's name. “As a guardrail on the returns agent” is a different feature: guardrails validate inputs and outputs, they do not route. “As new instructions for the triage agent” is not what happens, since the triage agent's instructions stay the same. And “As a separate run that starts from zero” is wrong, because the handoff happens inside the same run, and the returns agent sees the full history.
Fairhaven’s support agent uses a large, costly model, and some of its tools change orders. The team wants off-topic requests rejected before the agent uses any tokens, or runs any tool. How should the input guardrail run?
- In parallel with the agent, the default
- After the final answer, as an output check
- After the agent’s first tool call
- Blocking: run_in_parallel set to False
Show the answer
Blocking: run_in_parallel set to False
With run_in_parallel set to False, the guardrail completes before the agent starts, so a blocked request uses no tokens, and runs no tool. “In parallel with the agent, the default” is fast, but the agent may already have used tokens and run tools before the tripwire fires. “After the final answer, as an output check” would check only the final answer, after the work is done. And “After the agent’s first tool call” would let a tool run before any check, which is exactly what the team wants to avoid.
In Fairhaven’s system, the triage agent hands off to the returns agent, which has a function tool that issues store credit. The team wants every call to that tool checked, whichever agent makes it. What should they use?
- A tool input guardrail on the credit tool
- An input guardrail on the returns agent
- An output guardrail on the triage agent
- A handoff description on the returns agent
Show the answer
A tool input guardrail on the credit tool
A tool guardrail is configured on the tool itself, and runs every time the tool is called, before it executes. “An input guardrail on the returns agent” would never run here, because input guardrails run only for the first agent, and the returns agent comes after a handoff. “An output guardrail on the triage agent” checks a final answer, and only for the last agent of a run. And “A handoff description on the returns agent” only tells the model when to choose the returns agent.