99 DisallowTransferAndContentLimitLlmAgent ,
1010)
1111from agents .matmaster_agent .flow_agents .model import PlanStepStatusEnum
12+ from agents .matmaster_agent .flow_agents .step_utils import get_current_step
1213from agents .matmaster_agent .llm_config import LLMConfig
13- from agents .matmaster_agent .locales import i18n
14+ from agents .matmaster_agent .state import (
15+ CURRENT_STEP ,
16+ CURRENT_STEP_STATUS ,
17+ CURRENT_STEP_TOOL_NAME ,
18+ )
1419from agents .matmaster_agent .sub_agents .built_in_agent .llm_tool_agent .constant import (
1520 TOOL_AGENT_NAME ,
1621)
@@ -33,19 +38,13 @@ async def _run_events(self, ctx: InvocationContext) -> AsyncGenerator[Event, Non
3338 async for event in super ()._run_events (ctx ):
3439 yield event
3540
36- update_plan = copy .deepcopy (ctx .session .state ['plan' ])
37- update_plan ['steps' ][ctx .session .state ['plan_index' ]][
38- 'status'
39- ] = PlanStepStatusEnum .SUCCESS
40- yield update_state_event (ctx , state_delta = {'plan' : update_plan })
41-
42- current_step = ctx .session .state ['plan' ]['steps' ][
43- ctx .session .state ['plan_index' ]
44- ]
45- current_step_tool_name = current_step ['tool_name' ]
41+ post_execution_step = copy .deepcopy (get_current_step (ctx ))
42+ post_execution_step [CURRENT_STEP_STATUS ] = PlanStepStatusEnum .SUCCESS
43+ yield update_state_event (ctx , state_delta = {CURRENT_STEP : post_execution_step })
44+ current_step_tool_name = post_execution_step [CURRENT_STEP_TOOL_NAME ]
4645 step_title = ctx .session .state .get ('step_title' , {}).get (
4746 'title' ,
48- f" { i18n . t ( ctx . session . state [ 'separate_card_info' ]) } { ctx . session . state [ 'plan_index' ] + 1 } : { current_step_tool_name } " ,
47+ current_step_tool_name ,
4948 )
5049 for matmaster_flow_event in context_function_event (
5150 ctx ,
0 commit comments