liveBook · Manning

Agent tree

As explained in Build an AI Agent (From Scratch)

An agent tree is a hierarchical structure that organizes agents through parent, child, and sibling relationships and defines permitted transfers.

An agent tree organizes multi-agent control through parent, child, and sibling relationships. A router selects a specialist with transfer_to_agent; the specialist inherits the conversation context, completes the task, and can transfer follow-up work elsewhere. section 9.5.3

Build the structure around explicit ownership and permitted movement:

  • Register specialists in a parent's sub_agents list; assigning sub_agents automatically records each child's parent. section 9.5.3
  • Require unique agent names within each tree and reject an agent that already has another parent. section 9.5.3
  • Allow transfers to children, the parent, and optionally siblings; disallow_transfer_to_peers restricts a specialist to upward movement. section 9.5.3

Router with specialist agents

Create a router with math and search children. A calculation request transfers to math, which can return to router or transfer to search when peer movement is enabled. Setting disallow_transfer_to_peers=True leaves math with router as its only target.

How Build an AI Agent (From Scratch) covers it

How deep it goes
Descends from transfer behavior into Python-style state tracking, relationship validation, target enumeration, and recursive name lookup.
Examples
Uses a router with math and search specialists, plus configurable sibling-transfer behavior.
What it assumes
Assumes familiarity with agents and transfer tools while defining parent-child relationships, naming rules, and permissions explicitly.
What you can do after
Build multi-agent routing with validated ownership, explicit transfer targets, and name-based agent resolution.
How it connects
Connects transfer patterns with Agent as Tool, Sequential, Parallel, Loop, and A2A protocol integration.

Related concepts

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.