Skip to content

Conversation

mkmeral
Copy link
Contributor

@mkmeral mkmeral commented Sep 12, 2025

Description

Added configurable entry point support to the Swarm multi-agent system. Previously, swarms always started execution with the first agent in the list, which limited flexibility in orchestrating agent workflows. This change introduces an optional entry_point parameter that allows users to specify which agent should initiate the swarm execution.

Key Changes:

  • Added entry_point parameter to Swarm constructor (optional, defaults to None)
  • Enhanced validation to ensure specified entry points exist in the swarm
  • Updated swarm initialization logic to use configured entry point or fall back to first agent
  • Maintained full backward compatibility - existing code continues to work unchanged
  • Added comprehensive test coverage including validation error scenarios

Usage Example:

# Before: Always starts with first agent
swarm = Swarm([coordinator, analyst, writer])

# After: Can specify which agent starts
swarm = Swarm([coordinator, analyst, writer], entry_point="analyst")

Related Issues

N/A - Feature enhancement request

Documentation PR

N/A - No documentation changes required for this internal API enhancement

Type of Change

New feature

Testing

How have you tested the change?

  • Added 3 new unit tests covering:
    • Configurable entry point functionality
    • Invalid entry point validation (including random strings)
    • Default behavior preservation
  • Verified all existing swarm tests continue to pass (17/17 passing)
  • Confirmed integration tests remain functional (2/2 passing)
  • Tested backward compatibility with existing swarm usage patterns

Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mkmeral mkmeral enabled auto-merge (squash) September 12, 2025 13:44
@mkmeral mkmeral merged commit cbdab32 into strands-agents:main Sep 12, 2025
11 of 12 checks passed
This was referenced Sep 17, 2025
Unshure pushed a commit to Unshure/sdk-python that referenced this pull request Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants