@@ -536,6 +536,39 @@ def test_remaining_tool_calls_decrement(self, mock_agent):
536536 assert reasoning .remaining_tool_calls == 0
537537 assert result3 .llm_plan .tool_calls == [mock_tool_3 ] # index 2 (3-1=2)
538538
539+ def test_aplan_uses_async_memory_method (self , llm_response_factory , mock_agent ):
540+ mock_agent .step_prompt = "Default step prompt"
541+ mock_agent .agenerate_obs = AsyncMock (
542+ return_value = Observation (step = 1 , self_state = {}, local_state = {})
543+ )
544+ mock_agent .memory = Mock ()
545+ mock_agent .memory .format_long_term .return_value = ""
546+ mock_agent .memory .format_short_term .return_value = ""
547+ mock_agent .memory .aadd_to_memory = AsyncMock ()
548+ mock_agent .memory .add_to_memory = Mock ()
549+ mock_agent .llm = Mock ()
550+ mock_agent .tool_manager = Mock ()
551+ mock_agent .tool_manager .get_all_tools_schema .return_value = {}
552+
553+ mock_plan_response = llm_response_factory (content = "Async plan content" )
554+ mock_exec_response = llm_response_factory (
555+ content = "Exec" ,
556+ tool_calls = [_tool_call ("call_1" )],
557+ )
558+ mock_agent .llm .agenerate = AsyncMock (
559+ side_effect = [mock_plan_response , mock_exec_response ]
560+ )
561+
562+ reasoning = ReWOOReasoning (mock_agent )
563+ reasoning .aexecute_tool_call = AsyncMock (
564+ return_value = Plan (step = 1 , llm_plan = mock_exec_response .choices [0 ].message )
565+ )
566+
567+ asyncio .run (reasoning .aplan ())
568+
569+ mock_agent .memory .aadd_to_memory .assert_awaited_once ()
570+ mock_agent .memory .add_to_memory .assert_not_called ()
571+
539572
540573class TestReWOOSignatureConsistency :
541574 def test_plan_accepts_obs_kwarg (self ):
0 commit comments