Strategy Routing
The Strategy Router classifies every incoming task and selects one of four execution strategies: SimpleReAct, DAG Parallel, MCTS, or Hypothesis. This ensures simple tasks run quickly, complex pipelines get full multi-agent execution, and open-ended scientific questions get iterative hypothesis-driven reasoning.Why Strategy Routing?
Biological tasks vary widely:- Simple: “What does BRCA1 do?” or “Convert FASTA to GenBank.”
- Structured: “Run QC, normalization, clustering, and annotation on pbmc.h5ad.”
- Exploratory: “Find drug repurposing candidates for target X.”
- Scientific hypothesis: “What causes immunotherapy resistance in melanoma?” or “Propose a mechanism for FOXP3-mediated T-cell suppression.”
Two-Phase Classification
Phase 1: Heuristic Classification
Regex and structural cues score the task for each strategy:- Simple indicators: lookups, conversions, single-entity queries → boost SimpleReAct.
- Pipeline indicators: multi-step keywords, commas/semicolons, step counts → boost DAG.
- Exploratory indicators: discovery, candidate finding, screening → boost MCTS.
- Hypothesis indicators: “what causes”, “propose mechanism”, “generate hypothesis”, “novel biomarker”, “how does X resist/evade” → boost Hypothesis.
Phase 2: LLM Classification (Ambiguous Cases)
When confidence from Phase 1 is below 0.75, the task is sent to the fast LLM with a structured prompt that asks for:- Strategy choice (
react/dag_parallel/mcts/hypothesis) - Confidence (0.0–1.0)
- Short reasoning
- Complexity score and estimated step count
TaskClassification.
Domain Detection
Twelve biological domain patterns (genomics, pharmacology, ecology, neuroscience, cell biology, immunology, cancer biology, molecular biology, microbiology, plant biology, marine biology, bioimaging) are matched against the task to produce a multi-label domain classification. This is used for:- Downstream tool and KG subgraph selection
- Episodic memory domain filtering
- Reporting and analytics
The Four Strategies
Strategy 1: SimpleReAct
When: Simple or direct tasks (lookups, conversions, single-step data questions). How: An enhanced ReAct loop:- LLM produces a short numbered plan with checkboxes.
- Execute one step; observe output.
- Update plan with
[✓]/[✗]; repeat until done or max steps reached.
Strategy 2: DAG Parallel
When: Structured multi-step workflows (typical bioinformatics pipelines). How:- Planner decomposes the task into a TaskDAG (nodes = subtasks, edges = dependencies).
- Execution proceeds by topological levels; within each level, all ready nodes run in parallel (
asyncio.gather()). - Each node: Execute → Validate (Critic) → Retry if needed (reflection-guided repair, deep retry, or LATM).
- Synthesizer compiles results into a single final report.
Strategy 3: MCTS (Exploratory)
When: Open-ended tasks with high epistemic uncertainty where the optimal analysis path is unknown a priori (e.g. drug discovery, candidate screening, target identification). How:- Select: UCB1-guided traversal from the root to a leaf or expandable node.
- Expand: LLM generates several candidate next actions.
- Simulate: LLM estimates the value (reward) of the path.
- Backpropagate: Update visit counts and average rewards along the path.
- After a fixed budget of iterations, extract the best path (most-visited children).
- Convert the path to a DAG and execute via the standard pipeline.
Strategy 4: Hypothesis (Scientific Reasoning)
When: Open-ended scientific questions requiring iterative hypothesis generation, testing, and refinement. Examples:- “What causes resistance to immunotherapy in triple-negative breast cancer?”
- “Propose a mechanism by which FOXP3 suppresses effector T-cell activation.”
- “What are novel biomarkers for early-stage pancreatic cancer?”
- “How does KRAS G12C mutation drive resistance to targeted therapy?”
| Phase | Action |
|---|---|
| Generate | LLM produces 3–5 distinct, falsifiable candidate hypotheses (statement + mechanism + testable prediction). |
| Design | For each active hypothesis, design a targeted test: code execution, literature search, knowledge-graph query, or pure reasoning. |
| Execute | Run the test (sandbox code / PubMed+Semantic Scholar / KG / LLM reasoning). |
| Evaluate | Score evidence polarity (supports / contradicts / neutral) and confidence. Contradicting evidence is penalized 1.5×. |
| Update | Mark hypotheses as supported, rejected, or converged (confidence ≥ threshold). |
| Refine | After round 2+, surviving hypotheses are refined based on accumulated evidence to avoid repeating failed directions. |
| Synthesize | Produce a final scientific report: leading hypothesis + evidence trail + alternative hypotheses + recommended next steps. |
net_confidence):
net_confidence ≥ 0.80 (default, configurable) after at least 2 rounds.
Inspired by:
- Biomni A1 —
<think>/<execute>/<observe>checklist loop with[✓]/[✗]markers - PantheonOS Evolution — Analyzer → Mutator → Evaluator with failed-hypothesis history (avoid repeating rejected directions)
- CellType CLI —
EvidenceReasonerwith weighted claim scoring and contradiction detection
Hypothesis Trigger Keywords
The following patterns automatically route to the Hypothesis strategy (heuristic phase):| Pattern | Example |
|---|---|
hypothesis (any context) | “Generate a hypothesis about X” |
propose mechanism | ”Propose a mechanism for FOXP3 suppression” |
what causes | ”What causes drug resistance in NSCLC?” |
could … cause | ”Could BRCA1 loss cause genomic instability?” |
mechanism of/behind/for | ”Mechanism of cisplatin resistance” |
why does/do … [disease/resistance] | ”Why do tumors evade immune checkpoint therapy?” |
generate hypothesis | ”Generate hypotheses about aging” |
novel biomarker | ”Identify novel biomarkers for early PDAC” |
potential mechanism | ”What are potential mechanisms for X?” |
how does … resist/evade/escape | ”How does GBM evade temozolomide?” |
propose … target/candidate/pathway | ”Propose candidate drug targets for ALS” |
Strategy Comparison
| Dimension | SimpleReAct | DAG Parallel | MCTS | Hypothesis |
|---|---|---|---|---|
| Best for | Direct Q&A, conversions | Multi-step pipelines | Unknown optimal path | Scientific mechanism questions |
| Planning | Checklist plan | Full TaskDAG | Tree search path | Round-by-round design |
| Parallelism | Sequential | Within-level parallel | Sequential | Per-hypothesis parallel |
| Self-correction | Retry loop | Reflection + deep retry | Path re-selection | Contradiction tracking + refinement |
| Output | Code result / answer | Synthesis report | Synthesis report | Evidence-annotated scientific report |
| Token cost | Low | Medium–High | High | Medium (bounded by rounds) |
Forcing a Strategy
Override auto-routing from the CLI or API:Configuration
Strategy selection thresholds and LLM usage can be influenced by config (e.g. confidence threshold for LLM fallback, Hypothesis convergence threshold, max rounds). See Configuration for relevant options.Next Steps
- Multi-Agent Pipeline — How the DAG pipeline runs in detail.
- Hybrid Retrieval — How tools are selected for each step.
- CLI Reference — Running analyses from the terminal.