diff --git a/swarms/structs/auto_swarm_builder.py b/swarms/structs/auto_swarm_builder.py index 514cb79c..08c75164 100644 --- a/swarms/structs/auto_swarm_builder.py +++ b/swarms/structs/auto_swarm_builder.py @@ -407,6 +407,8 @@ class AutoSwarmBuilder: agents_dictionary = model.run(task) + agents_dictionary = json.loads(agents_dictionary) + return agents_dictionary except Exception as e: @@ -437,6 +439,8 @@ class AutoSwarmBuilder: f"Create the swarm spec for the following task: {task}" ) + swarm_spec = json.loads(swarm_spec) + print(swarm_spec) print(type(swarm_spec)) diff --git a/tests/structs/test_auto_swarms_builder.py b/tests/structs/test_auto_swarms_builder.py index 1d6e8762..9631db29 100644 --- a/tests/structs/test_auto_swarms_builder.py +++ b/tests/structs/test_auto_swarms_builder.py @@ -59,6 +59,10 @@ def test_agent_building(): agents = swarm.create_agents_from_specs(specs) agent = agents[0] + # 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.agent_description}") @@ -116,7 +120,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(