fix: Agent 运行整体 600s 超时兜底(模型/工具卡死时释放单实例)

This commit is contained in:
2026-09-04 12:59:28 +08:00
parent 04e83bbb31
commit f732c40b84
+2 -1
View File
@@ -146,7 +146,8 @@ def _agent_thread(run_id, prompt, cfg):
await agent._load_tools()
return await agent.run(prompt, cfg.get("default_serial") or "")
answer = asyncio.run(_run())
# 整体超时保护:模型/工具卡死时结束运行,避免单实例被永久占用
answer = asyncio.run(asyncio.wait_for(_run(), timeout=600))
with _lock:
_run["state"] = "done"
_run["answer"] = answer