fix: delegate analysis planning from main agent

This commit is contained in:
wtx
2026-08-08 10:40:01 +08:00
parent bfbddb544c
commit 5f240d1eec
3 changed files with 324 additions and 40 deletions
+19 -40
View File
@@ -223,9 +223,10 @@ goal=new_analysis. Asking only for status or progress without requesting a new p
goal=project_status. The Router must not choose the next stages itself.
Do not select a workflow for ordinary
chat, product help, external knowledge, existing results, job files, or utilities.
For an unspecified RNA-seq mode, leave workflow_id null and ask whether the request is
whole-genome or confirmed-family-member RNA-seq. Workflow contracts guide conversation
and handoff only; PlanningAgentV2 remains responsible for executable stage planning.
For goal=new_analysis, do not ask for an analysis mode, select a workflow, or select
stages. Leave workflow_id and clarification_question null and request analysis_intent;
the existing IntentAgent and PlanningAgent own missing analysis choices and executable
stage planning.
For goal=new_analysis, classify analysis_request_kind as guidance when the user asks
what should be done now, how to continue, or which analysis comes next. Use execution
@@ -428,6 +429,20 @@ class RouterRuntime:
"utility": "propose_utility",
}[decision.goal]
@staticmethod
def _analysis_handoff_decision(decision: RouteDecision) -> RouteDecision:
if decision.goal != "new_analysis":
return decision
return RouteDecision(
goal="new_analysis",
needs=["analysis_intent"],
subject=decision.subject,
referent=decision.referent,
interaction_kind=decision.interaction_kind,
analysis_request_kind=decision.analysis_request_kind,
confirms_pending_proposal=decision.confirms_pending_proposal,
)
@staticmethod
def _pending_analysis_proposal(
goal_ledger: GoalLedger | None,
@@ -730,43 +745,7 @@ class RouterRuntime:
message="The Router returned two invalid route decisions.",
tool_trace=decision_trace,
)
query_lower = str(query or "").lower()
has_rnaseq_marker = any(
token in query_lower
for token in ("rna-seq", "rnaseq", "rna seq", "转录组")
)
explicit_family_member = has_rnaseq_marker and any(
token in query_lower
for token in (
"基因家族成员",
"家族成员",
"family member",
"family-member",
)
)
explicit_whole_genome = has_rnaseq_marker and any(
token in query_lower
for token in ("全基因组", "whole genome", "whole-genome")
)
if (
confirmed_proposal is None
and (explicit_family_member or explicit_whole_genome)
and (
decision.goal != "new_analysis"
or decision.clarification_question is not None
)
):
decision = RouteDecision(
goal="new_analysis",
needs=["analysis_intent"],
subject=query,
interaction_kind=decision.interaction_kind,
workflow_id=(
"rnaseq_family_member"
if explicit_family_member
else "rnaseq_whole_genome"
),
)
decision = self._analysis_handoff_decision(decision)
authorized_input_paths = _extract_authorized_input_paths(query)
if (
decision.goal == "new_analysis"