Skip to content

Commit 280b079

Browse files
committed
fix: move BeforeMultiAgentInvocationEvent to stream_async
1 parent 55ef47c commit 280b079

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/strands/multiagent/graph.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ def __call__(
469469
if invocation_state is None:
470470
invocation_state = {}
471471

472-
self.hooks.invoke_callbacks(BeforeMultiAgentInvocationEvent(self, invocation_state))
473472
return run_async(lambda: self.invoke_async(task, invocation_state))
474473

475474
async def invoke_async(
@@ -517,6 +516,8 @@ async def stream_async(
517516
if invocation_state is None:
518517
invocation_state = {}
519518

519+
self.hooks.invoke_callbacks(BeforeMultiAgentInvocationEvent(self, invocation_state))
520+
520521
logger.debug("task=<%s> | starting graph execution", task)
521522

522523
# Initialize state

src/strands/multiagent/swarm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ def __call__(
288288
"""
289289
if invocation_state is None:
290290
invocation_state = {}
291-
self.hooks.invoke_callbacks(BeforeMultiAgentInvocationEvent(self, invocation_state))
292291
return run_async(lambda: self.invoke_async(task, invocation_state))
293292

294293
async def invoke_async(
@@ -337,6 +336,8 @@ async def stream_async(
337336
if invocation_state is None:
338337
invocation_state = {}
339338

339+
self.hooks.invoke_callbacks(BeforeMultiAgentInvocationEvent(self, invocation_state))
340+
340341
logger.debug("starting swarm execution")
341342

342343
if not self._resume_from_session:

0 commit comments

Comments
 (0)