You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/concurrent_swarm_example.py

34 lines
1.0 KiB

from swarms import Agent, ConcurrentWorkflow
from swarms.prompts.finance_agent_sys_prompt import (
FINANCIAL_AGENT_SYS_PROMPT,
)
if __name__ == "__main__":
# Assuming you've already initialized some agents outside of this class
agents = [
Agent(
agent_name=f"Financial-Analysis-Agent-{i}",
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
model_name="gpt-4o",
max_loops=1,
)
for i in range(3) # Adjust number of agents as needed
]
# Initialize the workflow with the list of agents
workflow = ConcurrentWorkflow(
agents=agents,
metadata_output_path="agent_metadata_4.json",
output_type="list",
show_progress=False,
max_loops=3,
interactive=True,
)
# Define the task for all agents
task = "How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?"
# Run the workflow and save metadata
metadata = workflow.run(task)
print(metadata)