@@ -1088,30 +1088,31 @@ async def test_state_reset_only_with_cycles_enabled():
10881088 # With reset_on_revisit enabled, reset should be called
10891089 mock_reset .assert_called_once ()
10901090
1091+
10911092@pytest .mark .asyncio
10921093async def test_graph_kwargs_passing_agent (mock_strands_tracer , mock_use_span ):
10931094 """Test that kwargs are passed through to underlying Agent nodes."""
10941095 # Create a mock agent that captures kwargs
10951096 kwargs_agent = create_mock_agent ("kwargs_agent" , "Response with kwargs" )
1096-
1097+
10971098 async def capture_kwargs (* args , ** kwargs ):
10981099 # Store kwargs for verification
10991100 capture_kwargs .captured_kwargs = kwargs
11001101 return kwargs_agent .return_value
1101-
1102+
11021103 kwargs_agent .invoke_async = MagicMock (side_effect = capture_kwargs )
1103-
1104+
11041105 # Create graph
11051106 builder = GraphBuilder ()
11061107 builder .add_node (kwargs_agent , "kwargs_node" )
11071108 graph = builder .build ()
1108-
1109+
11091110 # Execute with custom kwargs
11101111 test_kwargs = {"custom_param" : "test_value" , "another_param" : 42 }
11111112 result = await graph .invoke_async ("Test kwargs passing" , ** test_kwargs )
1112-
1113+
11131114 # Verify kwargs were passed to agent
1114- assert hasattr (capture_kwargs , ' captured_kwargs' )
1115+ assert hasattr (capture_kwargs , " captured_kwargs" )
11151116 assert capture_kwargs .captured_kwargs == test_kwargs
11161117 assert result .status == Status .COMPLETED
11171118
@@ -1121,28 +1122,28 @@ async def test_graph_kwargs_passing_multiagent(mock_strands_tracer, mock_use_spa
11211122 """Test that kwargs are passed through to underlying MultiAgentBase nodes."""
11221123 # Create a mock MultiAgentBase that captures kwargs
11231124 kwargs_multiagent = create_mock_multi_agent ("kwargs_multiagent" , "MultiAgent response with kwargs" )
1124-
1125+
11251126 # Store the original return value
11261127 original_result = kwargs_multiagent .invoke_async .return_value
1127-
1128+
11281129 async def capture_kwargs (* args , ** kwargs ):
11291130 # Store kwargs for verification
11301131 capture_kwargs .captured_kwargs = kwargs
11311132 return original_result
1132-
1133+
11331134 kwargs_multiagent .invoke_async = AsyncMock (side_effect = capture_kwargs )
1134-
1135+
11351136 # Create graph
11361137 builder = GraphBuilder ()
11371138 builder .add_node (kwargs_multiagent , "multiagent_node" )
11381139 graph = builder .build ()
1139-
1140+
11401141 # Execute with custom kwargs
11411142 test_kwargs = {"custom_param" : "test_value" , "another_param" : 42 }
11421143 result = await graph .invoke_async ("Test kwargs passing to multiagent" , ** test_kwargs )
1143-
1144+
11441145 # Verify kwargs were passed to multiagent
1145- assert hasattr (capture_kwargs , ' captured_kwargs' )
1146+ assert hasattr (capture_kwargs , " captured_kwargs" )
11461147 assert capture_kwargs .captured_kwargs == test_kwargs
11471148 assert result .status == Status .COMPLETED
11481149
@@ -1151,24 +1152,24 @@ def test_graph_kwargs_passing_sync(mock_strands_tracer, mock_use_span):
11511152 """Test that kwargs are passed through to underlying nodes in sync execution."""
11521153 # Create a mock agent that captures kwargs
11531154 kwargs_agent = create_mock_agent ("kwargs_agent" , "Response with kwargs" )
1154-
1155+
11551156 async def capture_kwargs (* args , ** kwargs ):
11561157 # Store kwargs for verification
11571158 capture_kwargs .captured_kwargs = kwargs
11581159 return kwargs_agent .return_value
1159-
1160+
11601161 kwargs_agent .invoke_async = MagicMock (side_effect = capture_kwargs )
1161-
1162+
11621163 # Create graph
11631164 builder = GraphBuilder ()
11641165 builder .add_node (kwargs_agent , "kwargs_node" )
11651166 graph = builder .build ()
1166-
1167+
11671168 # Execute with custom kwargs
11681169 test_kwargs = {"custom_param" : "test_value" , "another_param" : 42 }
11691170 result = graph ("Test kwargs passing sync" , ** test_kwargs )
1170-
1171+
11711172 # Verify kwargs were passed to agent
1172- assert hasattr (capture_kwargs , ' captured_kwargs' )
1173+ assert hasattr (capture_kwargs , " captured_kwargs" )
11731174 assert capture_kwargs .captured_kwargs == test_kwargs
1174- assert result .status == Status .COMPLETED
1175+ assert result .status == Status .COMPLETED
0 commit comments