mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-06 14:22:47 +02:00
fix(multi-agent): degrade to builtins-only when MCP or subagent registry build fails
This commit is contained in:
parent
3cb2c3056e
commit
a421e7d792
2 changed files with 16 additions and 3 deletions
|
|
@ -129,7 +129,16 @@ async def create_multi_agent_chat_deep_agent(
|
|||
}
|
||||
|
||||
_t0 = time.perf_counter()
|
||||
mcp_tools_by_agent = await load_mcp_tools_by_connector(db_session, search_space_id)
|
||||
try:
|
||||
mcp_tools_by_agent = await load_mcp_tools_by_connector(db_session, search_space_id)
|
||||
except Exception as e:
|
||||
# Degrade to builtins-only rather than aborting the turn: a transient
|
||||
# DB or MCP-server hiccup should not deny the user a response.
|
||||
logging.warning(
|
||||
"MCP tool discovery failed; subagents will run without MCP tools this turn: %s",
|
||||
e,
|
||||
)
|
||||
mcp_tools_by_agent = {}
|
||||
_perf_log.info(
|
||||
"[create_agent] load_mcp_tools_by_connector in %.3fs (%d buckets)",
|
||||
time.perf_counter() - _t0,
|
||||
|
|
|
|||
|
|
@ -126,8 +126,12 @@ def build_main_agent_deepagent_middleware(
|
|||
[s["name"] for s in subagents_registry],
|
||||
)
|
||||
except Exception:
|
||||
logging.exception("Subagents registry build failed")
|
||||
raise
|
||||
# Degrade to general-purpose-only rather than aborting the turn:
|
||||
# one bad subagent dep should not deny the user a response.
|
||||
logging.exception(
|
||||
"Subagents registry build failed; falling back to general-purpose only"
|
||||
)
|
||||
subagents_registry = []
|
||||
|
||||
subagents: list[SubAgent] = [general_purpose_subagent, *subagents_registry]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue