AIOps Peach

Agents · Module 04

Multi-Agent Collaboration

When one agent is not enough: collaboration patterns, a hierarchical supervisor system, how agents share state and messages, and what to do when one fails.

Học tương tác →

Học xong bạn làm được

Bài học

  1. Why multiple agents?

    A multi-agent system splits work among specialised agents. That brings specialisation (better accuracy in each domain), parallel processing of independent tasks, modularity (each agent is its own module) and scalability (new agents without touching the old). Typical teams are a software development team, a customer service team and a content creation pipeline.

  2. Collaboration patterns

    Four ways for agents to work together - sequential (a pipeline in which each agent's output is the next one's input), hierarchical (a primary assistant routes to specialised agents, as in the FPT chatbot), network (peers talk directly with no supervisor) and competitive (several agents solve the same problem and the best solution wins).

  3. Hierarchical multi-agent system: state

    In the hierarchical FPT system a primary assistant supervises four agents. All agents share one AgenticState - the messages, a dialog stack recording which agent is in control, and context such as conversation_id, user_id and an optional email. A custom reducer pushes an agent onto the stack when it takes over and pops it when it hands control back.

  4. Context injection

    Context injection copies user information such as user_id and email from the state into every tool call that needs it, so agents never have to remember and pass it themselves. The context is stored in the state, injected into the primary assistant's routing calls after the model answers, accepted as optional fields in the tool schema, and used by the tool when present.

  5. State transitions and tool call fallback

    An entry node hands control to a child agent - it answers the hand-over tool call with a ToolMessage that tells the agent its role and pushes the agent onto the dialog stack. A routing function maps the primary assistant's tool call to the right entry node, and the graph wires entry, agent, tool and leave nodes. Tool nodes get a fallback that turns failures into error ToolMessages.

  6. Complete or escalate

    A child agent ends when its task is done and nothing more is needed, and escalates back to the primary assistant when the task is out of scope, needs the primary assistant's capabilities, the user changes their mind, or it needs clarification it cannot get. A CompleteOrEscalate tool, a router that separates leaving from safe and sensitive tools, and the agent's prompt implement the decision.

  7. Tool arg schemas in a multi-tool system

    Pydantic schemas validate a tool's input before it runs, document its parameters, give type safety and IDE completion. Fields carry descriptions, validators enforce rules such as a future booking time or a digits-only phone, Literal limits a status to fixed values, args_schema attaches the schema to a tool, and each agent gets its own set of schemas.

  8. Communication patterns

    Agents communicate by message passing - structured messages that say who sends what to whom, and state updates returned as messages - and through shared memory - every agent can read the conversation context, the dialog stack and the message history from the shared state.

  9. Error handling and pattern comparison

    Multi-agent systems handle errors with retry logic, graceful degradation (a reduced fallback path when the database fails), a fixed response to communication failures (log, tell the user, optionally retry or escalate) and caching of repeated tool calls. A comparison table sets a single ReAct agent against a hierarchical multi-agent system and the supervisor pattern.

  10. Multi-agent orchestration in 2026

    Four topologies dominate production - supervisor (hub-and-spoke, the most common and the most auditable), hierarchical (a director over sub-supervisors, for ten or more agents), swarm (peer-to-peer, fault-tolerant but hard to debug) and pipeline (fixed, replayable stages). LangGraph, CrewAI, AutoGen/AG2, Pydantic AI and DSPy reflect different philosophies; MCP and A2A carry agent communication.

  11. Practice: the FPT chatbot - overview, context, FAQ and tickets

    The practice system is a hierarchical FPT customer chatbot - a primary assistant routing to FAQ, ticket support, IT support and booking agents. An optional email is injected from the conversation context into every related tool. The FAQ agent answers FPT policy questions with sources; the ticket agent creates, tracks and updates tickets that go Pending, Resolving, Finished, or Canceled.

  12. Practice: the FPT chatbot - IT support, booking and routing

    The IT support agent searches reliable technology sources with Tavily in Vietnamese and English. The booking agent books, tracks, updates and cancels meeting rooms, which go Scheduled, Finished, or Canceled. The primary assistant analyses intent, routes each request to the right agent and takes control back when a child agent is done.

  13. Practice: the FPT chatbot - database and business rules

    The chatbot stores tickets, bookings and conversation context in three tables. Business rules fix the starting statuses (Pending, Scheduled), which records can still change, and that email is always optional - injected from the context, overridable in a tool call, never required - while agents hand control back and forth and share the context.

  14. Practice: the FPT chatbot - advanced features and workflows

    Two optional advanced features - email notifications when a ticket or booking changes, and human-in-the-loop confirmation before important operations - must never be required. Four workflows trace a ticket creation, a booking, an FAQ question and an IT support request from the user through the primary assistant and the child agent.

  15. Assignment: FPT Customer Chatbot - Multi-Agent System

    FPT Customer Chatbot - Multi-Agent System