Recommended resources
The freely available resources this lesson will direct you to.
Hello!
In our last lesson, we developed a framework to decide when a multi-agent system is the right architecture, weighing the trade-offs between a single versatile agent and a team of specialists. We concluded that for complex, decomposable tasks, a multi-agent approach often offers superior maintainability and performance, provided the cost and domain knowledge constraints are respected.
Now that you can justify the choice of a multi-agent system, the next logical step is to design its core components. This lesson focuses on the heart of the system: the specialists themselves. Our learning outcome is to design specialized agents with narrow, well-defined roles that compose into a complete workflow.
We will break down a business process into its constituent parts and define the precise responsibilities, capabilities, and boundaries for each agent. This is where your system design skills truly come to the fore, moving from abstract architecture to concrete specifications.
1. The Principle of Specialization: From Task to Team
The decision to use a multi-agent system is fundamentally a decision to decompose a problem. In software engineering, we do this by creating modular, single-responsibility functions or services. In agentic design, we create modular, single-responsibility agents.
The core principle is the same: a complex task is made more manageable, predictable, and debuggable by breaking it into smaller, well-defined jobs. Let's start by seeing what this looks like in practice.
Hierarchical multi-agent systems with LangGraph
This video from LangChain demonstrates a simple but powerful multi-agent system with a supervisor and two specialists. It's a perfect illustration of task decomposition.
Watch from the beginning to 01:36. Note how the problem ('get the headcount of FANG companies and sum them') is naturally decomposed into two distinct tasks: research and calculation. This immediately suggests the need for two specialized agents.
This simple example highlights the core design process:
- Analyze the overall goal.
- Identify the distinct, separable sub-tasks required to achieve it.
- Assign each sub-task to a conceptual "specialist."
2. Anatomy of a Specialized Agent
Once you've identified the need for a specialist, you must define it. A specialized agent is defined by three key components: its role, its tools, and its boundaries. This is directly analogous to defining a class or microservice by its purpose, its methods, and its interface.
A. Role and Persona (System Prompt)
The system prompt is the agent's job description. It must clearly and unambiguously state the agent's purpose, expertise, and constraints. For example:
- For a Research Agent: "You are a world-class research analyst. Your sole responsibility is to find and synthesize information from the web to answer specific questions. You do not interpret results or perform calculations."
- For a Math Agent: "You are a precise mathematician. You only perform calculations based on the data you are given. You do not search for information or provide qualitative opinions."
B. Tools and Capabilities (The Principle of Least Authority)
An agent should only be given access to the tools it absolutely needs to perform its role. This is the principle of least authority applied to agentic systems. A research agent gets a web search tool; a math agent gets a calculator tool. Giving a math agent a web search tool invites unpredictability and potential failure modes.
Let's see how these two components—the prompt and the tools—come together to define a specialist.
Hierarchical multi-agent systems with LangGraph
Returning to the LangChain video, let's look at how the 'Math Expert' and 'Research Expert' are actually defined. Pay close attention to how each agent is given a specific system prompt and a narrow set of tools.
Watch from 04:41 to 05:18. Observe how the MathExpert is given mathematical tools and a prompt about math, while the ResearchExpert is given a search tool and a different prompt. This is the 'narrow, well-defined role' in practice.
C. Boundaries and Interfaces
Designing the agent's tools is a critical part of the process. You can think of it as designing an API for the LLM. The clarity and robustness of your tool definitions will directly impact the reliability of your agent.
Building Effective AI Agents - Appendix 2: Prompt engineering your tools
This concept of providing specific tools is fundamental. The design of these tools is as important as the agent's main prompt. Anthropic's research offers excellent guidance on this, which they call 'Agent-Computer Interfaces' (ACI).
Read 'Appendix 2: Prompt engineering your tools'. Think of this as designing an API for your agent. The key principles—making tools obvious, testing their use, and designing them to be mistake-proof ('poka-yoke')—are directly analogous to good API design in traditional software engineering.
3. Composition Patterns: Assembling the Workflow
Having designed your individual specialists, you need to arrange them into a system that accomplishes the overall goal. Several common patterns exist for composing agents into a workflow. These patterns provide architectural blueprints for your system.
The Google Cloud documentation offers a superb catalogue of these patterns. Let's review the most fundamental ones.
Choose a design pattern for your agentic AI system
With our specialists defined, we can assemble them into a coherent workflow. This documentation provides an excellent overview of common design patterns for composing multi-agent systems.
Please read the following sections to understand three fundamental composition patterns: Sequential pattern: For linear, step-by-step processes where the output of one agent is the input to the next. Parallel pattern: For tasks where sub-agents can work concurrently to save time or gather diverse perspectives. Review and critique pattern: A specific and powerful type of loop for quality assurance, where one agent generates work and another evaluates it. For each pattern, consider a business use case where it would be the optimal choice.
These patterns—sequential, parallel, and looped critique—form the basis for many agentic workflows. For example, an article writing workflow might use them all:
- Parallel: A
ResearchAgentand anOutlineAgentwork concurrently. - Sequential: The output of both is passed to a
DraftingAgent. - Loop/Critique: The draft is passed to a
ReviewAgent, which sends it back to theDraftingAgentwith feedback until the quality standard is met.
4. Dynamic Composition: The Orchestrator-Worker Pattern
The patterns above are often deterministic. However, many complex tasks require a more dynamic approach where the sub-tasks are not known in advance. For this, we use an Orchestrator-Worker pattern.
In this model, a central "Orchestrator" or "Planner" agent analyzes the main task and dynamically breaks it down into sub-tasks, which are then delegated to a team of "Worker" agents.
Building Effective Agents with LangGraph
This video from LangChain demonstrates the Orchestrator-Worker pattern for a report-writing task. It's a powerful approach for complex, unpredictable workflows.
Watch from 13:53 to 19:39. Focus on the core concept: a 'planner' LLM dynamically generates a list of subtasks (report sections), and then these are assigned to independent worker agents that run in parallel. The results are then synthesized.
This pattern is a specific implementation of a broader architectural model often called the Coordinator Pattern. This is a crucial concept that bridges to our next topic.
Choose a design pattern for your agentic AI system
Let's formalize the idea of the orchestrator with the Google Cloud documentation's definition of the 'Coordinator Pattern'.
Read the section on the Coordinator pattern. Note the key distinction it makes from the parallel pattern: the coordinator uses an AI model to dynamically route tasks, offering more flexibility than a hardcoded workflow. This is the pattern we will explore in detail in our next lesson.
5. Visualizing Composed Workflows in Business Context
These patterns can seem abstract, but they are the architectural backbone of real-world business automation. Let's look at two diagrams that show these principles in action.

Conclusion
Today we have moved from the why of multi-agent systems to the how. You now have a systematic process for designing the specialist agents that form the building blocks of a complex workflow.
Key Takeaways:
- Decomposition is Key: Begin by decomposing a complex business process into single-responsibility sub-tasks. Each sub-task is a candidate for a specialized agent.
- Define Specialists by Role, Tools, and Boundaries: A robust specialist agent has a clear system prompt defining its role, a minimal set of tools based on the principle of least authority, and well-designed interfaces (tool definitions).
- Compose Specialists Using Established Patterns: Simple workflows can be built using deterministic patterns like Sequential and Parallel. Quality can be enforced using the Review-and-Critique loop.
- Use Coordinators for Dynamic Tasks: For complex problems where the sub-steps aren't known beforehand, the Orchestrator/Coordinator Pattern provides the necessary flexibility by using an LLM to decompose the task and delegate work dynamically.
In our next lesson, we will focus entirely on that coordinator role. Having designed the team of specialists, we must now design their manager. Our next goal will be to design a router agent that delegates incoming tasks to the correct specialized agent based on content.