forked from kyegomez/swarms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhiearchical_swarm_example.py
More file actions
49 lines (42 loc) · 1.28 KB
/
hiearchical_swarm_example.py
File metadata and controls
49 lines (42 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from swarms import Agent, HierarchicalSwarm
# Create specialized agents
research_agent = Agent(
agent_name="Research-Analyst",
agent_description="Specialized in comprehensive research and data gathering",
model_name="gpt-5.4",
max_loops=1,
verbose=False,
)
analysis_agent = Agent(
agent_name="Data-Analyst",
agent_description="Expert in data analysis and pattern recognition",
model_name="gpt-5.4",
max_loops=1,
verbose=False,
)
strategy_agent = Agent(
agent_name="Strategy-Consultant",
agent_description="Specialized in strategic planning and recommendations",
model_name="gpt-5.4",
max_loops=1,
verbose=False,
)
# Create hierarchical swarm with interactive dashboard
swarm = HierarchicalSwarm(
name="Swarms Corporation Operations",
description="Enterprise-grade hierarchical swarm for complex task execution",
agents=[research_agent, analysis_agent, strategy_agent],
max_loops=1,
director_model_name="claude-haiku-4-5",
director_temperature=1.0,
director_top_p=None,
parallel_execution=True,
agent_as_judge=True,
judge_agent_model_name="gpt-5.4",
planning_enabled=False,
)
# print(swarm.display_hierarchy())
out = swarm.run(
"Conduct a research analysis on water stocks and etfs"
)
print(out)