Skip to content

Commit 9373242

Browse files
committed
fix: update comments
1 parent f984617 commit 9373242

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/strands/multiagent/swarm.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def __call__(
246246
task: The task to execute
247247
invocation_state: Additional state/context passed to underlying agents.
248248
Defaults to None to avoid mutable default argument issues.
249-
**kwargs: Additional keyword arguments passed to underlying agents.
249+
**kwargs: Keyword arguments allowing backward compatible future changes.
250250
"""
251251
if invocation_state is None:
252252
invocation_state = {}
@@ -268,7 +268,7 @@ async def invoke_async(
268268
invocation_state: Additional state/context passed to underlying agents.
269269
Defaults to None to avoid mutable default argument issues - a new empty dict
270270
is created if None is provided.
271-
**kwargs: Additional keyword arguments passed to underlying agents.
271+
**kwargs: Keyword arguments allowing backward compatible future changes.
272272
"""
273273
if invocation_state is None:
274274
invocation_state = {}
@@ -296,9 +296,7 @@ async def invoke_async(
296296
self.execution_timeout,
297297
)
298298

299-
# Merge kwargs into invocation_state for internal execution
300-
merged_state = {**invocation_state, **kwargs}
301-
await self._execute_swarm(merged_state)
299+
await self._execute_swarm(invocation_state)
302300
except Exception:
303301
logger.exception("swarm execution failed")
304302
self.state.completion_status = Status.FAILED

tests/strands/multiagent/test_graph.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,9 @@ async def test_graph_kwargs_passing_multiagent(mock_strands_tracer, mock_use_spa
13171317
test_invocation_state = {"custom_param": "test_value", "another_param": 42}
13181318
result = await graph.invoke_async("Test kwargs passing to multiagent", test_invocation_state)
13191319

1320-
kwargs_multiagent.invoke_async.assert_called_once_with([{"text": "Test kwargs passing to multiagent"}], test_invocation_state)
1320+
kwargs_multiagent.invoke_async.assert_called_once_with(
1321+
[{"text": "Test kwargs passing to multiagent"}], test_invocation_state
1322+
)
13211323
assert result.status == Status.COMPLETED
13221324

13231325

0 commit comments

Comments
 (0)