-
Notifications
You must be signed in to change notification settings - Fork 445
Description
sdk-python/src/strands/multiagent/graph.py
Line 493 in 8c63d75
node not in self.state.completed_nodes |
The reset_on_revisit
feature in Graph multiagent pattern fails to enable cycles/feedback loops because _find_newly_ready_nodes
filters out completed nodes before they can be revisited.
Bug Details
The problematic code:
def _find_newly_ready_nodes(self) -> list["GraphNode"]:
"""Find nodes that became ready after the last execution."""
newly_ready = []
for _node_id, node in self.nodes.items():
if (
node not in self.state.completed_nodes # <- BUG: prevents revisiting
and node not in self.state.failed_nodes
and self._is_node_ready_with_conditions(node)
):
newly_ready.append(node)
return newly_ready
Expected Behavior
When reset_on_revisit=True and a feedback edge condition is satisfied, completed nodes should be re-executed with their state reset.
Actual Behavior
Completed nodes are never reconsidered for execution, making feedback loops impossible even when reset_on_revisit=True.
Impact
Cannot implement feedback loops (e.g., error correction cycles) in Graph-based multi-agent systems.
Suggested Fix
Allow completed nodes to be added to newly_ready when incoming edge conditions are satisfied and revisiting is enabled.