liveBook · Manning

Chaining

As explained in Build a Multi-Agent System (from Scratch)

Chaining is a multi-agent pattern in which an agent dispatches subagents sequentially, often passing results between dependent subtasks.

Chaining coordinates subagents by dispatching them in sequence. Use it when a task has dependent subtasks: each later subagent waits for the result of the preceding step. A coordinator can follow an order specified in its task instruction or a skill; it can also determine the next subagent as execution progresses. section 9.4.3

Choose chaining when the overall task can be expressed as sequential work:

  • For a known sequence, specify the dispatch order in the task instruction or encapsulate it in a skill. section 9.4.3
  • For adaptive work, let the coordinator select subsequent steps and subagents as execution progresses. section 9.4.3

Find and extend a Hailstone sequence

Ask one subagent to read a file of known Hailstone sequences. The coordinator compares their step counts, selects the starting number with the most steps, and asks a second subagent to compute the sequence for twice that number. The second task depends on the first subtask’s result. section 9.4.3

Figure 9.13 The Chaining MAS pattern where the main or coordinator LLM agent dispatches the subagents in a sequence (often known in advance), each handling a portion of the task that builds up to the final result

Diagram of a coordinator dispatching subagents in sequence, with each step contributing to the final result. section 9.4.3

How Build a Multi-Agent System (from Scratch) covers it

How deep it goes
Explains dispatch order, result dependencies, and task instructions, but does not detail the broader implementation.
Examples
Uses a daily AI-advances report and a Hailstone task that finds the longest recorded sequence before computing a doubled starting number.
What you can do after
Apply chaining by ordering subagent tasks and making dependent steps wait for earlier results.
How it connects
Connects subagents and coordinator LLM agents to Router and Fan-out patterns.

Related concepts

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