# Multi-Agent Flows

> Use multiple LlamaIndex agents to orchestrate complex flows.

## What are Multi-Agent Flows? [#what-are-multi-agent-flows]

When building agentic applications, you often want to orchestrate complex flows together that require the coordination of multiple
agents. This is traditionally called multi-agent orchestration.

## When should I use this? [#when-should-i-use-this]

As your agentic application grows, delegation of sub-tasks to other agents can help you scale key pieces of your application.

- Divide context into smaller chunks
- Delegate sub-tasks to other agents
- Use a single agent to orchestrate the flow

## How does CopilotKit support this? [#how-does-copilotkit-support-this]

Each chat talks to one agent. Set the agent with the `agent` prop on the `CopilotKit` provider:

```tsx
// [!code word:agent]
<CopilotKit runtimeUrl="<copilot-runtime-url>" agent="<the-name-of-the-agent>">
  {/* Your application components */}
</CopilotKit>
```

Without the `agent` prop, CopilotKit uses the agent named `default`.

To use several agents in one app, give each chat component or `useAgent` hook its own `agentId`.
