pull/1117/merge
CI-DEV 5 days ago committed by GitHub
commit 6ecc64ec07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -408,6 +408,10 @@ class AutoSwarmBuilder:
agents_dictionary = model.run(task) agents_dictionary = model.run(task)
# Parse JSON string if needed
if isinstance(agents_dictionary, str):
agents_dictionary = json.loads(agents_dictionary)
return agents_dictionary return agents_dictionary
except Exception as e: except Exception as e:
@ -438,6 +442,10 @@ class AutoSwarmBuilder:
f"Create the swarm spec for the following task: {task}" f"Create the swarm spec for the following task: {task}"
) )
# Parse JSON string if needed
if isinstance(swarm_spec, str):
swarm_spec = json.loads(swarm_spec)
print(swarm_spec) print(swarm_spec)
print(type(swarm_spec)) print(type(swarm_spec))
@ -504,7 +512,15 @@ class AutoSwarmBuilder:
if isinstance(agent_config, dict): if isinstance(agent_config, dict):
agent_config = AgentSpec(**agent_config) agent_config = AgentSpec(**agent_config)
agent = Agent(**agent_config) # Convert AgentSpec to dict for Agent constructor
if hasattr(agent_config, 'dict'):
agent_dict = agent_config.dict()
elif hasattr(agent_config, 'model_dump'):
agent_dict = agent_config.model_dump()
else:
agent_dict = agent_config
agent = Agent(**agent_dict)
agents.append(agent) agents.append(agent)
return agents return agents
@ -535,6 +551,8 @@ class AutoSwarmBuilder:
if self.execution_type == "return-agents": if self.execution_type == "return-agents":
return self.create_agents(task) return self.create_agents(task)
elif self.execution_type == "execute-swarm-router":
return self._execute_task(task)
elif self.execution_type == "return-swarm-router-config": elif self.execution_type == "return-swarm-router-config":
return self.create_router_config(task) return self.create_router_config(task)
elif self.execution_type == "return-agents-objects": elif self.execution_type == "return-agents-objects":

Loading…
Cancel
Save