# Multi-Agent System

> Build agents that work together.

**URL:** https://inference.sh/docs/examples/multi-agent
**Last updated:** 2026-09-18

---

Build agents that work together.

---

## The Concept

Complex tasks benefit from specialization. Instead of one agent doing everything, create specialists that delegate to each other.

---

## Example: Content Team

A content creation team with three agents:

```
Content Director (main)
├── Research Agent
├── Writer Agent
└── Editor Agent
```

---

## Step 1: Create Research Agent

**Name:** `research-agent`

**System Prompt:**
```
You are a research specialist. When asked about a topic:

1. Search for relevant information
2. Gather key facts and statistics
3. Identify authoritative sources
4. Summarize findings clearly

Return structured research notes, not final content.
```

**Tools:** `web-search`, `summarize`

---

## Step 2: Create Writer Agent

**Name:** `writer-agent`

**System Prompt:**
```
You are a content writer. When given research notes:

1. Create engaging, well-structured content
2. Use clear, accessible language
3. Include relevant examples
4. Format appropriately for the medium

Focus on quality writing, not research.
```

**Tools:** `gpt-4` (for writing assistance)

---

## Step 3: Create Editor Agent

**Name:** `editor-agent`

**System Prompt:**
```
You are an editor. When given a draft:

1. Check for clarity and flow
2. Fix grammar and style issues
3. Ensure consistency
4. Suggest improvements

Return the polished version with change notes.
```

**Tools:** `grammar-check`

---

## Step 4: Create Director Agent

**Name:** `content-director`

**System Prompt:**
```
You are a content director managing a team.

When asked to create content:
1. Send the topic to research-agent for research
2. Send research to writer-agent for drafting
3. Send draft to editor-agent for polishing
4. Review and deliver final content

Coordinate the team, don't do their work.
```

**Sub-Agents:** `research-agent`, `writer-agent`, `editor-agent`

---

## How It Works

```
You: Write a blog post about AI agents in 2025

Director: I'll coordinate the team on this.
          
          [Calling research-agent: "Research AI agents 2025 trends"]
          
          Research complete. Key findings:
          - Multi-modal agents emerging
          - Tool use becoming standard
          - Enterprise adoption growing
          
          [Calling writer-agent with research notes]
          
          Draft complete. 1,200 words covering trends,
          use cases, and predictions.
          
          [Calling editor-agent with draft]
          
          Editing complete. Final version ready.
          
          Here's your blog post:
          
          # The Rise of AI Agents in 2025
          
          ...polished, publication-ready content...
```

---

## Benefits

| Benefit | Description |
|---------|-------------|
| **Specialization** | Each agent excels at one thing |
| **Reusability** | Use the same research agent elsewhere |
| **Clarity** | Clear responsibilities, easier debugging |
| **Quality** | Multiple passes improve output |

---

## Other Multi-Agent Patterns

### Customer Support Team
```
Support Director
├── Triage Agent (categorize issues)
├── Technical Agent (solve tech problems)
├── Billing Agent (handle payments)
└── Escalation Agent (complex cases)
```

### Code Review Team
```
Review Lead
├── Style Agent (formatting, conventions)
├── Security Agent (vulnerabilities)
├── Performance Agent (optimization)
└── Documentation Agent (comments, docs)
```

### Sales Assistant
```
Sales Coordinator
├── Lead Qualifier (score leads)
├── Research Agent (company info)
├── Proposal Writer (create proposals)
└── Follow-up Agent (schedule, remind)
```

---

## Tips

**Start simple:**
- Begin with 2 agents
- Add more as needed
- Don't over-engineer

**Clear handoffs:**
- Define what each agent returns
- Make responsibilities explicit
- Avoid overlap

**Test individually:**
- Test each agent alone first
- Then test together
- Debug one at a time

**Use parallel turns when independent:**
- If research, writing, and editing must run in order, call one sub-agent per turn (as in the example above)
- If several sub-tasks are independent (for example, three research angles), instruct the director to call multiple sub-agents in one turn so they run in parallel
- See [sub-agents: parallel execution](/docs/agents/sub-agents#parallel-execution)

---

## That's It!

You've learned how to build multi-agent systems.

→ [Back to Docs](/docs)
