Skip to content

🚀 The fast, Pythonic way to build MCP servers and clients.

Add named model tiers to the agentic triage plans (#6228)

nate nowack29c9da361653
diff --git a/.github/agentic/flows/agentic_stack_plans.py b/.github/agentic/flows/agentic_stack_plans.py
index d5008d285..33a130678 100644
--- a/.github/agentic/flows/agentic_stack_plans.py
+++ b/.github/agentic/flows/agentic_stack_plans.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import argparse
import json
import re
from pathlib import Path
@@ -205,8 +206,30 @@ Bound each probe subprocess to 30 seconds. An MRE may be the final useful result
}
-def build_plans(directory: Path) -> dict[str, dict]:
- models = json.loads((directory / "stack-models.json").read_text())
+def tier_models(models: dict, tier: str | None) -> dict:
+ """Resolve a named model tier from stack-models.json.
+
+ A tier replaces the connection and any roles it names; unnamed roles keep
+ the default model. Each tier is registered as its own plan flows, and a
+ batch picks a tier by passing those plans in its runtime.
+ """
+ if tier is None:
+ return models
+ override = models["tiers"][tier]
+ return {
+ "connection_id": override.get("connection_id", models["connection_id"]),
+ "roles": {**models["roles"], **override.get("roles", {})},
+ }
+
+
+def plan_suffix(tier: str | None) -> str:
+ return "" if tier is None else f".{tier}"
+
+
+def build_plans(directory: Path, tier: str | None = None) -> dict[str, dict]:
+ models = tier_models(
+ json.loads((directory / "stack-models.json").read_text()), tier
+ )
result = {}
for role, output in OUTPUTS.items():
model_role = "triage" if role == "assess" else role
@@ -269,8 +292,10 @@ def build_plans(directory: Path) -> dict[str, dict]:
if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--tier", help="named tier from stack-models.json")
+ arguments = parser.parse_args()
directory = Path(__file__).resolve().parents[1] / "workflows"
- for role, plan in build_plans(directory).items():
- (directory / f"fastmcp-stack-{role}.plan.json").write_text(
- json.dumps(plan, indent=2) + "\n"
- )
+ for role, plan in build_plans(directory, arguments.tier).items():
+ name = f"fastmcp-stack-{role}{plan_suffix(arguments.tier)}.plan.json"
+ (directory / name).write_text(json.dumps(plan, indent=2) + "\n")
diff --git a/.github/agentic/flows/agentic_triage_plan.py b/.github/agentic/flows/agentic_triage_plan.py
index 31f94b6a8..991c86c3e 100644
--- a/.github/agentic/flows/agentic_triage_plan.py
+++ b/.github/agentic/flows/agentic_triage_plan.py
@@ -6,7 +6,13 @@ from copy import deepcopy
from pathlib import Path
from uuid import UUID
-from flows.agentic_stack_plans import COMMON, OBJECTIVES, Assessment, Reproduction
+from flows.agentic_stack_plans import (
+ COMMON,
+ OBJECTIVES,
+ Assessment,
+ Reproduction,
+ tier_models,
+)
BRANCHES = {
"verify": ("existing_review",),
@@ -17,6 +23,9 @@ BRANCHES = {
TERMINAL = ("completed", "failed", "crashed", "cancelled", "timed_out")
+MODEL_NAMES = {"gpt-6-luna": "Luna"}
+
+
def assessment_branch(value: dict) -> str:
decision = Assessment.model_validate(value).decision
return next(name for name, choices in BRANCHES.items() if decision in choices)
@@ -39,9 +48,8 @@ def build_triage_plan(models: dict, verify_id: UUID, finalize_id: UUID) -> dict:
def agent(role: str, inputs: dict, outputs: dict, objective: str) -> dict:
return {
"kind": "AgentNode",
- "label": "Assess issue · Luna"
- if role == "triage"
- else "Reproduce bug · Luna",
+ "label": ("Assess issue" if role == "triage" else "Reproduce bug")
+ + f" · {MODEL_NAMES.get(models['roles'][role]['id'], models['roles'][role]['id'])}",
"model": {
"connection_id": models["connection_id"],
**models["roles"][role],
@@ -182,11 +190,15 @@ if __name__ == "__main__":
parser.add_argument("--verify-deployment", type=UUID, required=True)
parser.add_argument("--finalize-deployment", type=UUID, required=True)
parser.add_argument("--output", type=Path, required=True)
+ parser.add_argument("--tier", help="named tier from stack-models.json")
arguments = parser.parse_args()
- models = json.loads(
- (
- Path(__file__).resolve().parents[1] / "workflows/stack-models.json"
- ).read_text()
+ models = tier_models(
+ json.loads(
+ (
+ Path(__file__).resolve().parents[1] / "workflows/stack-models.json"
+ ).read_text()
+ ),
+ arguments.tier,
)
plan = build_triage_plan(
models, arguments.verify_deployment, arguments.finalize_deployment
diff --git a/.github/agentic/tests/test_agentic_triage_review.py b/.github/agentic/tests/test_agentic_triage_review.py
index 80a3ee093..7355edd44 100644
--- a/.github/agentic/tests/test_agentic_triage_review.py
+++ b/.github/agentic/tests/test_agentic_triage_review.py
@@ -4,8 +4,9 @@ from uuid import uuid4
import pytest
-from flows.agentic_stack_plans import build_plans
+from flows.agentic_stack_plans import build_plans, tier_models
from flows.agentic_stack_runtime import AgentPlan, Runtime
+from flows.agentic_triage_plan import build_triage_plan
from flows.agentic_triage_review import apply_disposition, requires_review
@@ -209,3 +210,34 @@ def test_private_sweep_without_reviewer_skips_sol(monkeypatch):
assert result["bins"]["existing_review"] == [
{"issue_number": 7, "adversarial_review": None}
]
+
+
+def test_model_tier_swaps_named_roles_and_keeps_the_reviewer():
+ directory = Path(__file__).resolve().parents[1] / "workflows"
+ default = build_plans(directory)
+ haiku = build_plans(directory, "haiku")
+ assert haiku["assess"]["nodes"]["assess"]["model"]["id"] == "claude-haiku-5-5"
+ assert haiku["reproduce"]["nodes"]["reproduce"]["model"]["id"] == "claude-haiku-5-5"
+ assert haiku["triage_review"] == default["triage_review"]
+ assert (
+ haiku["assess"]["nodes"]["assess"]["model"]["connection_id"]
+ == default["assess"]["nodes"]["assess"]["model"]["connection_id"]
+ )
+
+
+def test_triage_plan_follows_the_tier():
+ models = json.loads(
+ (
+ Path(__file__).resolve().parents[1] / "workflows/stack-models.json"
+ ).read_text()
+ )
+ plan = build_triage_plan(tier_models(models, "haiku"), uuid4(), uuid4())
+ agents = [n for n in plan["nodes"].values() if n["kind"] == "AgentNode"]
+ assert agents and all(n["model"]["id"] == "claude-haiku-5-5" for n in agents)
+ assert all("Luna" not in n["label"] for n in agents)
+ default = build_triage_plan(models, uuid4(), uuid4())
+ assert all(
+ n["model"]["id"] == "gpt-6-luna"
+ for n in default["nodes"].values()
+ if n["kind"] == "AgentNode"
+ )
diff --git a/.github/agentic/workflows/stack-models.json b/.github/agentic/workflows/stack-models.json
index c5fc8eff4..779707d05 100644
--- a/.github/agentic/workflows/stack-models.json
+++ b/.github/agentic/workflows/stack-models.json
@@ -21,5 +21,23 @@
"comparison": {
"id": "claude-haiku-5-5",
"effort": "medium"
+ },
+ "tiers": {
+ "haiku": {
+ "roles": {
+ "match": {
+ "id": "claude-haiku-5-5",
+ "effort": "low"
+ },
+ "triage": {
+ "id": "claude-haiku-5-5",
+ "effort": "low"
+ },
+ "reproduce": {
+ "id": "claude-haiku-5-5",
+ "effort": "medium"
+ }
+ }
+ }
}
}