Download architecture/model-routing.md from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 3.17 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/architecture/model-routing.md
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/architecture/model-routing.md
-
curl -L -o model-routing.md https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/architecture/model-routing.md
Model routing: local vs frontier (P2P pilot)
Owner: AI Architect · Updated 2026-10-09 ~16:36 IST after the Chief of Staff's pilot decisions · Code: p2p_graph.py::route_model()
Pilot decision
Match tests keep real amounts, and nothing in a test case or result is redacted for local processing. Because those amounts are client data, all triage of match (and any other) failures stays local. The only thing allowed to reach a frontier model is redacted aggregate counts.
The rule (one function, fails closed)
frontier iff task == "summary"
AND payload is a dict whose keys are all in FRONTIER_COUNT_KEYS
{total, executed, passed, failed, flaky, skipped, deferred, needs_review,
real_defect, ui_change, data, timing, unclassified}
AND every value is an int (floats are rejected, so amounts can't slip in)
otherwise local
This replaces the earlier regex redactor. An allowlisted schema is stronger than pattern-matching free text: case ids, titles,
error messages, amounts and screenshots cannot pass, by construction. Every call is appended to llm_calls (node, route, model,
reason) and written to run-summary.json.
Step by step (pilot)
| Node | Engine | Route | Notes |
|---|---|---|---|
| load_cases | code | — | Reads tests/cases/*.yaml. P1/P2/P3 scope filter. |
| approval_gate | human | — | Consultant approves draft cases. |
| plan_data | code | — | Deterministic recipe lookup (data_recipes). The LLM was removed. |
| execute | Playwright | — | --retries=0. The graph owns the single retry. No LLM. |
| triage | triage/classifier.py (rules) |
— / local | Deterministic. With LOCAL_TRIAGE_HINTS=1, low-confidence items get a local-model note. route_model("triage", …) always returns local. Match failures with real amounts never leave. |
| human_review | human | — | Confirms real-defect and low-confidence verdicts, and names owners for flaky tests. |
| report | reports/generate_report.py |
— | Deterministic QA rule. Optional FRONTIER_SUMMARY=1: one frontier call with the counts dict only. |
Models (config only): local ollama/ministral-3:14b (listed at https://ollama.com/library/ministral-3, checked 2026-10-09) on a
local or client-hosted GPU (no rented cloud GPU with client data; see cost-estimate.md). Frontier mistral-large-2512, used only for
the optional counts summary.
Removed from routing (deferred by decision)
- LLM test design, the research swarm and the synthesizer. Cases come from the Test Designer and the Analyst's map.
- Script builder and self-heal. The retry is a plain re-run, and locator fixes are human.
- The LLM reporter. Ticketing is human.
What would need a new decision
- Any frontier use beyond counts (for example, public release-note analysis for test design) needs its own allowlisted payload type
and a Chief of Staff decision. Do not widen
FRONTIER_COUNT_KEYSto carry text. - The provider's data-retention terms still need confirming before even counts are sent for a client. Until then, keep
FRONTIER_SUMMARYoff.