Skip to content

Commit 6e2478b

Browse files
committed
feat:使用get_current_step函数更新提交代理创建失败步骤逻辑
1 parent 0763699 commit 6e2478b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

  • agents/matmaster_agent/core_agents/public_agents/job_agents/submit_core_agent

agents/matmaster_agent/core_agents/public_agents/job_agents/submit_core_agent/agent.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
DisallowTransferAndContentLimitMCPAgent,
1616
)
1717
from agents.matmaster_agent.flow_agents.model import PlanStepStatusEnum
18+
from agents.matmaster_agent.flow_agents.step_utils import get_current_step
1819
from agents.matmaster_agent.locales import i18n
1920
from agents.matmaster_agent.logger import PrefixFilter
2021
from agents.matmaster_agent.model import BohrJobInfo, DFlowJobInfo
21-
from agents.matmaster_agent.state import CURRENT_STEP
22+
from agents.matmaster_agent.state import CURRENT_STEP, CURRENT_STEP_STATUS
2223
from agents.matmaster_agent.style import tool_response_failed_card
2324
from agents.matmaster_agent.utils.event_utils import (
2425
all_text_event,
@@ -189,12 +190,14 @@ async def _run_events(self, ctx: InvocationContext) -> AsyncGenerator[Event, Non
189190
yield tool_response_failed_event
190191

191192
# 更新 plan 为失败
192-
update_plan = copy.deepcopy(ctx.session.state['plan'])
193-
update_plan['steps'][ctx.session.state['plan_index']][
194-
'status'
195-
] = 'failed'
193+
post_execution_step = copy.deepcopy(
194+
get_current_step(ctx)
195+
)
196+
post_execution_step[CURRENT_STEP_STATUS] = (
197+
PlanStepStatusEnum.FAILED
198+
)
196199
yield update_state_event(
197-
ctx, state_delta={'plan': update_plan}
200+
ctx, state_delta={CURRENT_STEP: post_execution_step}
198201
)
199202

200203
raise RuntimeError('Tool Execution Failed')

0 commit comments

Comments
 (0)