liveBook · Manning

Transfer target

As explained in Build an AI Agent (From Scratch)

A transfer target is an agent to which the current agent is permitted to transfer control.

A transfer target is an agent to which the current agent may hand over control. The target inherits the shared conversation context, completes the task, and leaves the result for the calling agent’s execution flow. section 9.5.3 section 9.5.5

Targets come from an agent tree rather than an unrestricted global list. An agent can transfer to its children, its parent, and—unless peer transfers are disabled—its siblings.

Define a reliable target set by enforcing these constraints:

  • Give every agent a unique name within the tree; transfer requests resolve targets by name. section 9.5.3
  • Describe each specialist so the current agent can select an appropriate destination. section 9.5.3

Router with specialist targets

A router manages math and search specialists. The router can transfer to either child; the math agent can transfer back to the router or across to search. Setting disallow_transfer_to_peers=True on math leaves only the router as its target.

At runtime, the agent registers a transfer tool for its targets, exposes that tool to the LLM, executes the selected call, and records the target name in execution context. The run loop resolves the name, invokes the target with the existing context, then exits the current agent’s loop. section 9.5.5

How Build an AI Agent (From Scratch) covers it

How deep it goes
Defines target resolution and implements registration, tool execution, context handoff, and loop termination.
Examples
Uses a router with math and search specialists, including a peer-transfer restriction example.
What it assumes
Assumes agents, parent-child relationships, execution context, and LLM tool calls.
What you can do after
Build it from scratch: implement tree validation, target lookup, transfer tools, and context-based handoffs.
How it connects
Connects agent trees, execution contexts, tool calling, and multi-agent systems.

This explainer was generated by Manning's knowledge graph from the text of Build an AI Agent (From Scratch). The section links point to the parts of the book it draws on.