forked from kyegomez/swarms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualizer_test.py
More file actions
67 lines (62 loc) · 1.76 KB
/
Copy pathvisualizer_test.py
File metadata and controls
67 lines (62 loc) · 1.76 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import asyncio
from swarms import Agent
from swarms.prompts.finance_agent_sys_prompt import (
FINANCIAL_AGENT_SYS_PROMPT,
)
from swarms.utils.visualizer import (
SwarmVisualizationRich,
SwarmMetadata,
) # Replace with your actual module name
# Create two example agents
agent1 = Agent(
agent_name="Financial-Analysis-Agent",
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
model_name="gpt-4o-mini",
max_loops=1,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="finance_agent.json",
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
return_step_meta=False,
output_type="string",
streaming_on=False,
)
# Create a second dummy agent for demonstration
agent2 = Agent(
agent_name="Stock-Advisor-Agent",
system_prompt="Provide stock market insights and investment advice.",
model_name="gpt-4o-mini",
max_loops=1,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="stock_agent.json",
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
return_step_meta=False,
output_type="string",
streaming_on=False,
)
# Create swarm metadata
metadata = SwarmMetadata(
name="Financial Swarm",
description="A swarm of agents focused on financial analysis and stock market advice.",
version="1.0",
author="Your Name",
primary_objective="Provide comprehensive financial and investment analysis.",
)
# Instantiate the visualizer with a list of agents
visualizer = SwarmVisualizationRich(
swarm_metadata=metadata,
agents=[agent1, agent2],
update_resources=True,
refresh_rate=0.1,
)
# Start the visualization
asyncio.run(visualizer.start())