|
|
|
|
@ -46,16 +46,22 @@ def test_agent_building():
|
|
|
|
|
print("Testing Agent Building")
|
|
|
|
|
try:
|
|
|
|
|
swarm = AutoSwarmBuilder()
|
|
|
|
|
agent = swarm.build_agent(
|
|
|
|
|
|
|
|
|
|
# Create agent spec
|
|
|
|
|
agent_spec = AgentSpec(
|
|
|
|
|
agent_name="TestAgent",
|
|
|
|
|
agent_description="A test agent",
|
|
|
|
|
agent_system_prompt="You are a test agent",
|
|
|
|
|
description="A test agent",
|
|
|
|
|
system_prompt="You are a test agent",
|
|
|
|
|
max_loops=1,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Create agent from spec
|
|
|
|
|
agents = swarm.create_agents_from_specs({"agents": [agent_spec]})
|
|
|
|
|
agent = agents[0]
|
|
|
|
|
|
|
|
|
|
print("✓ Built agent with configuration:")
|
|
|
|
|
print(f" - Name: {agent.agent_name}")
|
|
|
|
|
print(f" - Description: {agent.description}")
|
|
|
|
|
print(f" - Description: {agent.agent_description}")
|
|
|
|
|
print(f" - Max loops: {agent.max_loops}")
|
|
|
|
|
print("✓ Agent building test passed")
|
|
|
|
|
return agent
|
|
|
|
|
@ -74,13 +80,14 @@ def test_agent_creation():
|
|
|
|
|
description="A swarm for research tasks",
|
|
|
|
|
)
|
|
|
|
|
task = "Research the latest developments in quantum computing"
|
|
|
|
|
agents = swarm._create_agents(task)
|
|
|
|
|
agents_dict = swarm.create_agents(task)
|
|
|
|
|
agents = swarm.create_agents_from_specs(agents_dict)
|
|
|
|
|
|
|
|
|
|
print("✓ Created agents for research task:")
|
|
|
|
|
for i, agent in enumerate(agents, 1):
|
|
|
|
|
print(f" Agent {i}:")
|
|
|
|
|
print(f" - Name: {agent.agent_name}")
|
|
|
|
|
print(f" - Description: {agent.description}")
|
|
|
|
|
print(f" - Description: {agent.agent_description}")
|
|
|
|
|
print(f"✓ Created {len(agents)} agents successfully")
|
|
|
|
|
return agents
|
|
|
|
|
except Exception as e:
|
|
|
|
|
@ -103,7 +110,7 @@ def test_swarm_routing():
|
|
|
|
|
task = "Analyze the impact of AI on healthcare"
|
|
|
|
|
|
|
|
|
|
print("Starting task routing...")
|
|
|
|
|
result = swarm.swarm_router(agents, task)
|
|
|
|
|
result = swarm.initialize_swarm_router(agents, task)
|
|
|
|
|
|
|
|
|
|
print("✓ Task routed successfully")
|
|
|
|
|
print(
|
|
|
|
|
|