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.
46 lines
1.2 KiB
46 lines
1.2 KiB
from swarms.structs.tree_swarm import TreeAgent, Tree, ForestSwarm
|
|
|
|
# Example Usage:
|
|
|
|
# Create agents with varying system prompts and dynamically generated distances/keywords
|
|
agents_tree1 = [
|
|
TreeAgent(
|
|
system_prompt="Stock Analysis Agent",
|
|
agent_name="Stock Analysis Agent",
|
|
),
|
|
TreeAgent(
|
|
system_prompt="Financial Planning Agent",
|
|
agent_name="Financial Planning Agent",
|
|
),
|
|
TreeAgent(
|
|
agent_name="Retirement Strategy Agent",
|
|
system_prompt="Retirement Strategy Agent",
|
|
),
|
|
]
|
|
|
|
agents_tree2 = [
|
|
TreeAgent(
|
|
system_prompt="Tax Filing Agent",
|
|
agent_name="Tax Filing Agent",
|
|
),
|
|
TreeAgent(
|
|
system_prompt="Investment Strategy Agent",
|
|
agent_name="Investment Strategy Agent",
|
|
),
|
|
TreeAgent(
|
|
system_prompt="ROTH IRA Agent", agent_name="ROTH IRA Agent"
|
|
),
|
|
]
|
|
|
|
# Create trees
|
|
tree1 = Tree(tree_name="Financial Tree", agents=agents_tree1)
|
|
tree2 = Tree(tree_name="Investment Tree", agents=agents_tree2)
|
|
|
|
# Create the ForestSwarm
|
|
multi_agent_structure = ForestSwarm(trees=[tree1, tree2])
|
|
|
|
# Run a task
|
|
task = "Our company is incorporated in delaware, how do we do our taxes for free?"
|
|
output = multi_agent_structure.run(task)
|
|
print(output)
|