Skip to content

Commit 73ad2cc

Browse files
committed
Fix SwarmConfigLoader to handle agent top-level key requirement
- Wrap individual agent configs in 'agent:' key when loading swarm agents - Fixes compatibility with AgentConfigLoader top-level key requirement - Resolves swarm loading errors in configuration-driven systems Fixes issue where swarm agents failed to load with: 'Configuration must contain a top-level agent key'
1 parent 1a8754a commit 73ad2cc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/strands/experimental/config_loader/swarm/swarm_config_loader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ def load_agents(self, agents_config: List[Dict[str, Any]]) -> List[Agent]:
228228
cache_key = f"agent:{agent_name}"
229229

230230
try:
231-
agent = agent_loader.load_agent(agent_config, cache_key=cache_key)
231+
# Wrap the agent config in the required top-level 'agent' key
232+
wrapped_agent_config = {"agent": agent_config}
233+
agent = agent_loader.load_agent(wrapped_agent_config, cache_key=cache_key)
232234
agents.append(agent)
233235
logger.debug("agent_name=<%s> | loaded agent for swarm", agent_name)
234236
except Exception as e:

0 commit comments

Comments
 (0)