...

/

Building AI Agents in LlamaIndex: Multi-Agent System

Building AI Agents in LlamaIndex: Multi-Agent System

Learn how to build multi-agent AI systems with LlamaIndex.

In our previous lesson, we built a capable single-agent system—an intelligent assistant that could track orders, process returns, and help users find products. It handled customer queries quite well using tools and LLM-powered reasoning.

But let’s imagine a new situation.

A user says:
“I want to return my last order, and also suggest me a smartwatch that pairs well with a Samsung phone under $200.”

It sounds straightforward, but behind the scenes, this query involves two very different types of tasks:

  • Handling a return (which involves order data and processes)

  • Recommending a new product (which involves filtering, preferences, maybe even summarizing reviews)

Sure, our single FunctionAgent could try to do both.

But that’s like asking one employee to handle customer support, be your personal shopping assistant, and summarize reviews all at once.

Instead of overloading a single agent, what if we gave each of these responsibilities to a specialized agent?

Just like a real-world team, we’re now thinking in terms of collaboration. And just like that, we step into the world of multi-agent systems.

Press + to interact
LlamaIndex supports building intelligent agents as a core feature of its framework
LlamaIndex supports building intelligent agents as a core feature of its framework

Think of it like assembling a collaborative team:

  • One agent focuses on breaking down the task (like a planner).

  • Another focuses purely on retrieving and analyzing data.

  • A third specializes in communication—crafting responses in natural language.

Each agent knows its job, and they talk to each other to get things done.

This transition—from a single smart agent to a team of specialized agents—mirrors how we scale systems in real life. It allows our AI-powered workflows to become more modular, efficient, and even creative.

In this lesson, we’ll explore how to design such a multi-agent system, how these agents collaborate, and how we can orchestrate their conversations to solve more sophisticated problems.

Building a multi-agent system

We now introduce a team of agents, each with a clearly defined role:

  1. Query planner agent: This is the “manager” agent. It reads the user’s complex query and breaks it down into smaller subtasks. It then delegates each task to the most relevant agent.

  2. ...