Dashboard

Multi-Agent Coordination

Set up a manager agent that delegates tasks to specialized worker agents. Time: ~25 minutes.

What You Will Build

  • A Manager Agent that receives user requests and routes them
  • A Research Agent that looks up information
  • A Writer Agent that creates formatted responses
  • Trust policies that control which agents can communicate
  • Message routing between all three agents

How Multi-Agent Works

In ACP, agents communicate through a message bus. A manager agent can send tasks to worker agents and receive their results. Trust policies ensure only authorized agents can exchange messages.

Step-by-Step Guide

1

Create the Research Agent

This agent specializes in finding information and returning factual summaries.

curl -X POST http://localhost:8000/api/v1/agents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "research-worker",
    "description": "Specializes in researching topics and returning factual summaries",
    "model": "gpt-4o",
    "system_prompt": "You are a research specialist. When given a topic, provide a detailed factual summary with key points. Be thorough but concise. Return structured data.",
    "tags": ["worker", "research"]
  }'
# Save the agent ID as RESEARCH_AGENT_ID
2

Create the Writer Agent

This agent takes research data and creates polished, user-friendly responses.

curl -X POST http://localhost:8000/api/v1/agents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "writer-worker",
    "description": "Specializes in writing clear, formatted responses for end users",
    "model": "gpt-4o",
    "system_prompt": "You are a professional writer. Take the research data provided and craft a clear, well-structured response for end users. Use bullet points, headings, and simple language.",
    "tags": ["worker", "writer"]
  }'
# Save the agent ID as WRITER_AGENT_ID
3

Create the Manager Agent

The manager receives user requests, delegates to workers, and combines results.

curl -X POST http://localhost:8000/api/v1/agents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "team-manager",
    "description": "Manager that coordinates research and writing workers",
    "model": "gpt-4o",
    "system_prompt": "You are a team manager. When you receive a user query:\n1. Send the topic to the research-worker for investigation\n2. Send the research results to the writer-worker for formatting\n3. Return the final polished response to the user\nAlways delegate; do not try to do the work yourself.",
    "tags": ["manager", "coordinator"]
  }'
# Save the agent ID as MANAGER_AGENT_ID
4

Set Up Trust Policies

Define which agents can communicate with each other.

# Manager can send to Research worker
curl -X POST http://localhost:8000/api/v1/coordination/trust-policies \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_agent_id": "MANAGER_AGENT_ID",
    "target_agent_id": "RESEARCH_AGENT_ID",
    "trust_level": "full",
    "description": "Manager can delegate research tasks"
  }'

# Manager can send to Writer worker
curl -X POST http://localhost:8000/api/v1/coordination/trust-policies \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_agent_id": "MANAGER_AGENT_ID",
    "target_agent_id": "WRITER_AGENT_ID",
    "trust_level": "full",
    "description": "Manager can delegate writing tasks"
  }'

# Workers can respond to Manager
curl -X POST http://localhost:8000/api/v1/coordination/trust-policies \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_agent_id": "RESEARCH_AGENT_ID",
    "target_agent_id": "MANAGER_AGENT_ID",
    "trust_level": "full",
    "description": "Research worker can respond to manager"
  }'
5

Send a Message Between Agents

Test the communication by sending a message from the manager to the research worker.

curl -X POST http://localhost:8000/api/v1/coordination/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from_agent_id": "MANAGER_AGENT_ID",
    "to_agent_id": "RESEARCH_AGENT_ID",
    "content": "Research the latest trends in AI agent frameworks",
    "priority": "normal"
  }'
6

Run the Manager Agent

Give the manager a task and watch it coordinate the team.

curl -X POST http://localhost:8000/api/v1/agents/MANAGER_AGENT_ID/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Write me a summary of the best practices for building AI chatbots"
  }'

# The manager will:
# 1. Send the research task to research-worker
# 2. Wait for research results
# 3. Send results to writer-worker for formatting
# 4. Return the polished response
7

Monitor Agent Communication

View the message history between agents.

# List all messages for the manager
curl http://localhost:8000/api/v1/coordination/messages?agent_id=MANAGER_AGENT_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

# Check coordination status
curl http://localhost:8000/api/v1/coordination/agents \
  -H "Authorization: Bearer YOUR_API_KEY"

Architecture Diagram

Multi-Agent Flowtext
User Request
    |
    v
[Manager Agent]
    |
    +---> [Research Worker] ---> Research Results
    |                                   |
    +-----------------------------------+
    |
    +---> [Writer Worker] ---> Formatted Response
    |                                   |
    +-----------------------------------+
    |
    v
Final Response to User

Scaling Tips

  • Add more specialized workers (e.g., code-reviewer, translator) as needed
  • Use different models for different workers to optimize cost (e.g., GPT-4o for manager, GPT-3.5 for simple workers)
  • Set individual budgets per agent to control costs
  • Monitor the Coordination tab in the dashboard for message flow visualization