parent
3d4aa7a932
commit
582edf427f
@ -0,0 +1,51 @@
|
||||
"""
|
||||
Minimal Board of Directors Example
|
||||
|
||||
This example demonstrates the most basic Board of Directors swarm setup
|
||||
with minimal configuration and agents.
|
||||
|
||||
To run this example:
|
||||
1. Make sure you're in the root directory of the swarms project
|
||||
2. Run: python examples/multi_agent/board_of_directors/minimal_board_example.py
|
||||
"""
|
||||
|
||||
from swarms.structs.board_of_directors_swarm import (
|
||||
BoardOfDirectorsSwarm,
|
||||
)
|
||||
from swarms.structs.agent import Agent
|
||||
|
||||
|
||||
def run_minimal_example() -> str:
|
||||
"""Run a minimal Board of Directors example."""
|
||||
# Create a single agent
|
||||
agent = Agent(
|
||||
agent_name="General_Agent",
|
||||
agent_description="General purpose agent",
|
||||
model_name="gpt-4o-mini",
|
||||
max_loops=1,
|
||||
)
|
||||
|
||||
# Create minimal swarm
|
||||
board_swarm = BoardOfDirectorsSwarm(
|
||||
name="Minimal_Board",
|
||||
agents=[agent],
|
||||
verbose=False,
|
||||
)
|
||||
|
||||
# Execute minimal task
|
||||
task = "Provide a brief overview of artificial intelligence."
|
||||
return board_swarm.run(task=task)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Main function to run the minimal example."""
|
||||
|
||||
try:
|
||||
result = run_minimal_example()
|
||||
return result
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -0,0 +1,35 @@
|
||||
from swarms.structs.board_of_directors_swarm import (
|
||||
BoardOfDirectorsSwarm,
|
||||
)
|
||||
from swarms.structs.agent import Agent
|
||||
|
||||
# Create simple agents for basic tasks
|
||||
analyst = Agent(
|
||||
agent_name="Analyst",
|
||||
agent_description="Data analyst",
|
||||
model_name="gpt-4o-mini",
|
||||
max_loops=1,
|
||||
)
|
||||
|
||||
writer = Agent(
|
||||
agent_name="Writer",
|
||||
agent_description="Content writer",
|
||||
model_name="gpt-4o-mini",
|
||||
max_loops=1,
|
||||
)
|
||||
|
||||
agents = [analyst, writer]
|
||||
|
||||
# Create swarm with default settings
|
||||
board_swarm = BoardOfDirectorsSwarm(
|
||||
name="Simple_Board",
|
||||
agents=agents,
|
||||
verbose=False,
|
||||
)
|
||||
|
||||
# Execute simple task
|
||||
task = "Analyze current market trends and create a summary report."
|
||||
|
||||
result = board_swarm.run(task=task)
|
||||
|
||||
print(result)
|
@ -0,0 +1,9 @@
|
||||
from swarms import load_agents_from_markdown
|
||||
|
||||
agents = load_agents_from_markdown(["finance_advisor.md"])
|
||||
|
||||
# Use the agent
|
||||
response = agents[0].run(
|
||||
"I have $100k to invest. I want to hedge my bets on the energy companies that will benefit from the AI revoltion"
|
||||
"What are the top 4 stocks to invest in?"
|
||||
)
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue