[FIX][AgentMAPSimulation]

pull/1126/head
Kye Gomez 2 days ago
parent 5bae455600
commit 918dd41a38

@ -1,8 +1,7 @@
import orjson import json
from swarms import AutoSwarmBuilder from swarms import AutoSwarmBuilder
swarm = AutoSwarmBuilder( swarm = AutoSwarmBuilder(
name="My Swarm", name="My Swarm",
description="My Swarm Description", description="My Swarm Description",
@ -16,4 +15,4 @@ result = swarm.run(
task="Build a swarm to write a research paper on the topic of AI" task="Build a swarm to write a research paper on the topic of AI"
) )
print(orjson.dumps(result, option=orjson.OPT_INDENT_2).decode()) print(json.dumps(result, indent=2))

@ -1,45 +1,11 @@
#!/usr/bin/env python3
"""
Demo script for the Agent Map Simulation.
This script demonstrates how to set up and run a simulation where multiple AI agents
move around a 2D map and automatically engage in conversations when they come into
proximity with each other.
NEW: Task-based simulation support! You can now specify what the agents should discuss:
# Create simulation
simulation = AgentMapSimulation(map_width=50, map_height=50)
# Add your agents
simulation.add_agent(my_agent1)
simulation.add_agent(my_agent2)
# Run with a specific task
results = simulation.run(
task="Discuss the impact of AI on financial markets",
duration=300, # 5 minutes
with_visualization=True
)
Features demonstrated:
- Creating agents with different specializations
- Setting up the simulation environment
- Running task-focused conversations
- Live visualization
- Monitoring conversation activity
- Saving conversation summaries
Run this script to see agents moving around and discussing specific topics!
"""
import time import time
from typing import List from typing import List
from swarms import Agent from swarms import Agent
# Remove the formal collaboration prompt import from examples.multi_agent.simulations.agent_map.agent_map_simulation import (
from simulations.agent_map_simulation import AgentMapSimulation AgentMapSimulation,
)
# Create a natural conversation prompt for the simulation # Create a natural conversation prompt for the simulation
NATURAL_CONVERSATION_PROMPT = """ NATURAL_CONVERSATION_PROMPT = """

@ -7,8 +7,12 @@ what topic the agents should discuss when they meet.
""" """
from swarms import Agent from swarms import Agent
from simulations.agent_map_simulation import AgentMapSimulation from examples.multi_agent.simulations.agent_map.agent_map_simulation import (
from simulations.v0.demo_simulation import NATURAL_CONVERSATION_PROMPT AgentMapSimulation,
)
from examples.multi_agent.simulations.agent_map.v0.demo_simulation import (
NATURAL_CONVERSATION_PROMPT,
)
def create_simple_agent(name: str, expertise: str) -> Agent: def create_simple_agent(name: str, expertise: str) -> Agent:

@ -19,7 +19,9 @@ CASE: 34-year-old female with sudden severe headache
from typing import List from typing import List
from swarms import Agent from swarms import Agent
from simulations.agent_map_simulation import AgentMapSimulation from examples.multi_agent.simulations.agent_map.agent_map_simulation import (
AgentMapSimulation,
)
def create_medical_agent( def create_medical_agent(

@ -13,7 +13,7 @@ Run this to see agents naturally forming groups and having multi-party conversat
from swarms import Agent from swarms import Agent
from simulations.agent_map_simulation import ( from examples.multi_agent.simulations.agent_map.agent_map_simulation import (
AgentMapSimulation, AgentMapSimulation,
Position, Position,
) )

@ -8,7 +8,7 @@ that all components work correctly without requiring a GUI.
import time import time
from swarms import Agent from swarms import Agent
from simulations.agent_map_simulation import ( from examples.multi_agent.simulations.agent_map.agent_map_simulation import (
AgentMapSimulation, AgentMapSimulation,
Position, Position,
) )

Loading…
Cancel
Save