Skip to content

Commit 9092b0e

Browse files
authored
Merge pull request #1273 from Steve-Dusty/examples1
# Add Documentation for 5 Core Multi-Agent Architectures
2 parents 0b392e7 + 39213d8 commit 9092b0e

12 files changed

+3855
-22
lines changed
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
# AutoSwarmBuilder: 3-Step Quickstart Guide
2+
3+
The AutoSwarmBuilder automatically designs and creates specialized multi-agent teams based on your task description. Simply describe what you need, and it will generate agents with distinct roles, expertise, personalities, and comprehensive system prompts - then orchestrate them using the most appropriate swarm architecture.
4+
5+
## Overview
6+
7+
| Feature | Description |
8+
|---------|-------------|
9+
| **Automatic Agent Generation** | Creates agents with roles, personalities, and expertise based on task |
10+
| **Intelligent Architecture Selection** | Chooses optimal swarm type (Sequential, Concurrent, Hierarchical, etc.) |
11+
| **Comprehensive System Prompts** | Generates detailed prompts with decision-making frameworks |
12+
| **Flexible Execution** | Returns agents, swarm router config, or agent objects |
13+
14+
```
15+
Your Task Description
16+
17+
18+
AutoSwarmBuilder
19+
(Boss System Prompt)
20+
21+
22+
┌───────────────────────┐
23+
│ Auto-Generated Team │
24+
│ - Agent Roles │
25+
│ - Personalities │
26+
│ - System Prompts │
27+
│ - Architecture Type │
28+
└───────────────────────┘
29+
30+
31+
Ready to Run
32+
```
33+
34+
---
35+
36+
## Step 1: Install and Import
37+
38+
```bash
39+
pip install swarms
40+
```
41+
42+
```python
43+
from swarms.structs.auto_swarm_builder import AutoSwarmBuilder
44+
```
45+
46+
---
47+
48+
## Step 2: Create AutoSwarmBuilder
49+
50+
```python
51+
# Initialize the builder
52+
swarm_builder = AutoSwarmBuilder(
53+
name="Marketing-Team-Builder",
54+
description="Builds marketing teams automatically",
55+
model_name="gpt-4o", # Boss agent model
56+
max_loops=1,
57+
execution_type="return-agents", # or "return-swarm-router-config", "return-agents-objects"
58+
verbose=True
59+
)
60+
```
61+
62+
---
63+
64+
## Step 3: Generate and Run
65+
66+
```python
67+
# Describe what you need
68+
task = "Create a marketing team with 4 agents: market researcher, content strategist, copywriter, and social media specialist. They should collaborate on launching a new AI product."
69+
70+
# Auto-generate the team
71+
result = swarm_builder.run(task=task)
72+
73+
# The builder creates:
74+
# - 4 agents with specialized roles
75+
# - Comprehensive system prompts for each
76+
# - Appropriate swarm architecture
77+
# - Ready-to-use configuration
78+
79+
print(result)
80+
```
81+
82+
---
83+
84+
## Complete Example
85+
86+
```python
87+
from swarms.structs.auto_swarm_builder import AutoSwarmBuilder
88+
import json
89+
90+
# Create builder
91+
swarm = AutoSwarmBuilder(
92+
name="Product-Development-Team",
93+
description="Auto-generates product development teams",
94+
model_name="gpt-4o",
95+
max_loops=1,
96+
execution_type="return-agents",
97+
verbose=True
98+
)
99+
100+
# Define your need
101+
task = """
102+
Create a product development team with 5 specialized agents:
103+
1. Product Manager - oversees strategy and roadmap
104+
2. UX Designer - focuses on user experience
105+
3. Backend Engineer - handles server-side development
106+
4. Frontend Engineer - builds user interfaces
107+
5. QA Engineer - ensures quality and testing
108+
109+
The team should work together to plan and build a new mobile app feature.
110+
"""
111+
112+
# Generate the team
113+
team_config = swarm.run(task=task)
114+
115+
# View the generated team
116+
print(json.dumps(team_config, indent=2))
117+
```
118+
119+
---
120+
121+
## Execution Types
122+
123+
| Type | Returns | Use Case |
124+
|------|---------|----------|
125+
| `"return-agents"` | List of agent dictionaries | Inspect and customize agents |
126+
| `"return-swarm-router-config"` | Complete SwarmRouter configuration | Ready-to-use swarm |
127+
| `"return-agents-objects"` | List of Agent objects | Direct execution |
128+
129+
### Example: Get Ready-to-Run Swarm
130+
131+
```python
132+
swarm = AutoSwarmBuilder(
133+
name="Research-Team",
134+
model_name="gpt-4o",
135+
execution_type="return-swarm-router-config", # Get complete swarm
136+
)
137+
138+
result = swarm.run(
139+
"Create a research team with data analyst, statistician, and research coordinator"
140+
)
141+
142+
# Result is a complete SwarmRouter configuration
143+
# Ready to use immediately
144+
```
145+
146+
---
147+
148+
## Configuration Options
149+
150+
| Parameter | Default | Description |
151+
|-----------|---------|-------------|
152+
| `name` | Required | Name of the builder |
153+
| `description` | Required | Purpose of the builder |
154+
| `model_name` | `"gpt-4o"` | Model for the boss agent that designs teams |
155+
| `max_loops` | `1` | Loops for agent generation |
156+
| `execution_type` | `"return-agents"` | What to return |
157+
| `verbose` | `False` | Enable detailed logging |
158+
159+
---
160+
161+
## Use Cases
162+
163+
| Scenario | Team Description |
164+
|----------|------------------|
165+
| **Content Creation** | "Writers, editors, SEO specialists for blog content" |
166+
| **Software Development** | "Full-stack developers, QA engineers, DevOps for microservices" |
167+
| **Financial Analysis** | "Financial analysts, risk managers, compliance officers for investment portfolio" |
168+
| **Customer Support** | "Support agents, escalation specialists, quality reviewers for customer service" |
169+
| **Research** | "Researchers, data scientists, literature reviewers for scientific study" |
170+
171+
### Example: Financial Analysis Team
172+
173+
```python
174+
swarm = AutoSwarmBuilder(
175+
name="Financial-Team-Builder",
176+
model_name="gpt-4o",
177+
execution_type="return-agents",
178+
)
179+
180+
team = swarm.run(
181+
"""
182+
Create a financial analysis team with:
183+
- Equity Analyst: Analyzes stocks and market trends
184+
- Fixed Income Analyst: Evaluates bonds and debt instruments
185+
- Risk Manager: Assesses portfolio risk
186+
- Quantitative Analyst: Builds financial models
187+
188+
Team should collaborate on portfolio management and investment recommendations.
189+
"""
190+
)
191+
192+
print(f"Generated {len(team)} specialized financial agents")
193+
```
194+
195+
---
196+
197+
## How It Works
198+
199+
1. **Task Analysis**: Boss agent analyzes your requirements
200+
2. **Agent Design**: Creates agents with:
201+
- Unique roles and purposes
202+
- Distinct personalities
203+
- Comprehensive system prompts
204+
- Specific capabilities and limitations
205+
3. **Architecture Selection**: Chooses optimal swarm type
206+
4. **Configuration Generation**: Outputs ready-to-use configuration
207+
5. **Return**: Provides agents in requested format
208+
209+
---
210+
211+
## Advanced Features
212+
213+
### Custom Boss System Prompt
214+
215+
The boss agent uses a sophisticated system prompt that considers:
216+
- Task decomposition and analysis
217+
- Agent design excellence with personalities
218+
- Communication protocols and collaboration strategies
219+
- Multi-agent architecture selection
220+
- Quality assurance and governance
221+
222+
### Supported Swarm Architectures
223+
224+
The boss can select from:
225+
- AgentRearrange
226+
- MixtureOfAgents
227+
- SpreadSheetSwarm
228+
- SequentialWorkflow
229+
- ConcurrentWorkflow
230+
- GroupChat
231+
- MultiAgentRouter
232+
- HierarchicalSwarm
233+
- MajorityVoting
234+
- And more...
235+
236+
---
237+
238+
## Best Practices
239+
240+
- **Be Specific**: Provide clear, detailed task descriptions
241+
- **Define Roles**: Specify the types of agents you need
242+
- **State Objectives**: Explain what the team should accomplish
243+
- **Use Powerful Models**: Use gpt-4o or claude-sonnet for best results
244+
- **Review Output**: Always review and potentially customize generated agents
245+
246+
---
247+
248+
## Related Architectures
249+
250+
- [SwarmRouter](../swarms/examples/swarm_router.md) - Routes tasks to appropriate swarms
251+
- [HierarchicalSwarm](../swarms/examples/hierarchical_swarm_example.md) - Manual hierarchical teams
252+
- [Multi-Agent Examples](./multi_agent_architectures_overview.md) - Pre-built architectures
253+
254+
---
255+
256+
## Next Steps
257+
258+
- Explore [AutoSwarmBuilder Tutorial](../swarms/examples/auto_swarm_builder_example.md)
259+
- See [GitHub Examples](https://github.com/kyegomez/swarms/tree/master/examples/multi_agent/asb)
260+
- Learn about [Agent Design Principles](../swarms/concept/agent_design.md)

0 commit comments

Comments
 (0)