Multi-Agent Workflows ๐ฅ
๐ Beta Feature!
Unlock advanced automation by orchestrating multiple AI agents that collaborate within a single workflow. Learn how to design, connect, and manage systems where agents specialize in different tasks.
Multi-agent workflows allow you to:
- Break complex tasks into specialized agent roles
- Share results between agents using dependencies
- Reuse tools across different agents
- Create sophisticated processing pipelines
How Agents Work Together
In Graph Compose, agents collaborate through:
- Dependencies - Agents can depend on results from other agents
- Shared Tools - Multiple agents can use the same tools
- Result Passing - Results flow through the workflow graph
Here's a visualization of a multi-agent workflow:
flowchart LR
A[Research Agent] -->|Research Results| B[Writing Agent]
B -->|Draft Content| C[Review Agent]
D[Knowledge Base] -->|Used by| A
D -->|Used by| B
D -->|Used by| C
style A fill:#4F46E5,stroke:#4338CA,color:#fff,rx:10
style B fill:#4F46E5,stroke:#4338CA,color:#fff,rx:10
style C fill:#4F46E5,stroke:#4338CA,color:#fff,rx:10
style D fill:#10B981,stroke:#059669,color:#fff,rx:10
Building Multi-Agent Workflows
Here's how to structure a workflow with multiple agents:
{
"nodes": [
{
"id": "research_agent",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/research",
"method": "POST"
},
"tools": ["kb_search", "web_search"] // Tools for research
},
{
"id": "writing_agent",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/write",
"method": "POST"
},
"dependencies": ["research_agent"], // Uses research results
"tools": ["kb_search", "content_gen"] // Tools for writing
},
{
"id": "review_agent",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/review",
"method": "POST"
},
"dependencies": ["writing_agent"], // Reviews the written content
"tools": ["kb_search", "analyze"] // Tools for review
}
],
"tools": [
{
"id": "kb_search", // Shared knowledge base tool
"type": "http",
"http": {
"method": "GET",
"url": "https://api.example.com/kb/search"
}
},
{
"id": "web_search", // Research-specific tool
"type": "http",
"http": {
"method": "GET",
"url": "https://api.example.com/web/search"
}
},
{
"id": "content_gen", // Writing-specific tool
"type": "http",
"http": {
"method": "POST",
"url": "https://api.example.com/generate"
}
},
{
"id": "analyze", // Review-specific tool
"type": "http",
"http": {
"method": "POST",
"url": "https://api.example.com/analyze"
}
}
]
}
Common Patterns
Content Creation Pipeline
This pattern uses multiple agents to create and refine content:
{
"nodes": [
{
"id": "researcher",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/research",
"method": "POST",
"body": {
"task": "Research AI trends",
"depth": "comprehensive"
}
},
"tools": ["web_search", "kb_search"]
},
{
"id": "writer",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/write",
"method": "POST",
"body": {
"style": "technical",
"format": "blog"
}
},
"dependencies": ["researcher"],
"tools": ["content_gen", "kb_search"]
},
{
"id": "editor",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/edit",
"method": "POST",
"body": {
"check": ["grammar", "style", "accuracy"]
}
},
"dependencies": ["writer"],
"tools": ["analyze", "kb_search"]
}
]
}
Data Analysis Pipeline
This pattern combines agents for data processing and analysis:
{
"nodes": [
{
"id": "data_collector",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/collect",
"method": "POST",
"body": {
"sources": ["market_data", "social_media"],
"timeframe": "last_week"
}
},
"tools": ["data_fetch", "clean_data"]
},
{
"id": "analyzer",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/analyze",
"method": "POST",
"body": {
"analysis_type": ["trends", "patterns"]
}
},
"dependencies": ["data_collector"],
"tools": ["analyze", "visualize"]
},
{
"id": "reporter",
"type": "agent",
"http": {
"url": "https://api.example.com/agents/report",
"method": "POST",
"body": {
"format": "executive_summary"
}
},
"dependencies": ["analyzer"],
"tools": ["summarize", "format"]
}
]
}