Skip to content

[BUG] Swarm constructor creates unnecessary BedrockModel causing unwanted AWS service calls #980

@Drewbertius

Description

@Drewbertius

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

1.10.0

Python Version

3.13.5

Operating System

macOS Sequoia 15.7

Installation Method

pip

Steps to Reproduce

  1. Import Strands: from strands import Agent; from strands.multiagent import Swarm
  2. Create any agent with non-Bedrock model: agent = Agent(model=some_ollama_model)
  3. Create Swarm: swarm = Swarm([agent])
  4. Observe AWS service calls in logs despite using only Ollama models (attempt to connect to IMDS endpoint on http://169.254.169.254/, evalutation of AWS creds env vars. Issue appears to be in Swarm init where it creates a default Agent which will try and instantiate a default BedrockModel with Claude which result in the errors because environment is only using ollama and no AWS)

Expected Behavior

No AWS service calls should occur when using swarms with only non-Bedrock model providers like Ollama.

Actual Behavior

AWS credential resolution is attempted and BedrockModel initialization occurs, causing timeout errors and unnecessary AWS service calls, even though all agents in the swarm use OllamaModel (attempt to connect to IMDS endpoint on http://169.254.169.254/, evalutation of AWS creds env vars. Issue appears to be in Swarm init where it creates a default Agent which will try and instantiate a default BedrockModel with Claude which result in the errors because environment is only using ollama and no AWS).

Additional Context

Debug analysis shows the issue occurs in Swarm.init() at this line:

self.state = SwarmState(
   current_node=SwarmNode("", Agent()),  # <-- Agent() defaults to BedrockModel
   task="",
   completion_status=Status.PENDING,
)

This placeholder Agent is never used but triggers BedrockModel initialization immediately.

Possible Solution

Use a null model for the placeholder Agent or delay SwarmState creation until after _setup_swarm() when real agents are available.

Related Issues

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions