hermes: adaptively scale engineering routes
This commit is contained in:
parent
2ae88973be
commit
7dbde8e85d
@ -10,15 +10,15 @@ data:
|
||||
config.yaml: |
|
||||
model:
|
||||
provider: atlas-switchyard
|
||||
default: atlas/auto/maximum
|
||||
model: atlas/auto/maximum
|
||||
default: atlas/auto/balanced
|
||||
model: atlas/auto/balanced
|
||||
|
||||
providers:
|
||||
atlas-switchyard:
|
||||
name: Atlas Switchyard
|
||||
api: http://hermes-switchyard.hermes.svc.cluster.local:9005/v1
|
||||
api_key: atlas-switchyard
|
||||
default_model: atlas/auto/maximum
|
||||
default_model: atlas/auto/balanced
|
||||
transport: chat_completions
|
||||
|
||||
fallback_providers: []
|
||||
|
||||
@ -15,6 +15,7 @@ except ImportError: # Direct module loading in the small unit-test harness.
|
||||
|
||||
|
||||
POLICY_PATH = Path("/opt/data/workspace/coordinator/route-policy.json")
|
||||
POLICY_VERSION = 2
|
||||
SWITCHYARD_PROVIDER = "atlas-switchyard"
|
||||
ROUTER_PROFILE = os.environ.get("HERMES_AUTO_ROUTER_PROFILE", "").strip().lower()
|
||||
if ROUTER_PROFILE not in {"chat", "triage", "agent"}:
|
||||
@ -27,7 +28,7 @@ if ROUTER_PROFILE not in {"chat", "triage", "agent"}:
|
||||
PROFILE_ROUTE = {
|
||||
"chat": "atlas/auto/fast",
|
||||
"triage": "atlas/auto/deep",
|
||||
"agent": "atlas/auto/maximum",
|
||||
"agent": "atlas/auto/balanced",
|
||||
}
|
||||
PRIORITY_ROUTE = {
|
||||
"fast": "atlas/auto/fast",
|
||||
@ -65,6 +66,12 @@ def _load_policy() -> dict[str, Any]:
|
||||
value = {}
|
||||
if not isinstance(value, dict):
|
||||
value = {}
|
||||
if value.get("version") != POLICY_VERSION:
|
||||
value = {
|
||||
"version": POLICY_VERSION,
|
||||
"mode": "auto",
|
||||
"auto_route": PROFILE_ROUTE[ROUTER_PROFILE],
|
||||
}
|
||||
if value.get("mode") not in {"auto", "manual"}:
|
||||
value["mode"] = "auto"
|
||||
route = str(value.get("auto_route") or "")
|
||||
@ -75,6 +82,7 @@ def _load_policy() -> dict[str, Any]:
|
||||
|
||||
def _write_policy(value: dict[str, Any]) -> None:
|
||||
"""Persist route preference atomically inside the current workspace."""
|
||||
value["version"] = POLICY_VERSION
|
||||
POLICY_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
temporary = POLICY_PATH.with_suffix(".json.tmp")
|
||||
temporary.write_text(
|
||||
|
||||
@ -22,7 +22,7 @@ spec:
|
||||
labels:
|
||||
app: hermes-switchyard
|
||||
annotations:
|
||||
ai.bstein.dev/config-rev: "20260815-maximum-high-floor"
|
||||
ai.bstein.dev/config-rev: "20260815-quality-escalation"
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9005"
|
||||
prometheus.io/path: /metrics
|
||||
|
||||
@ -43,7 +43,7 @@ def test_profile_defaults_are_distinct_and_quality_ordered():
|
||||
assert router.PROFILE_ROUTE == {
|
||||
"chat": "atlas/auto/fast",
|
||||
"triage": "atlas/auto/deep",
|
||||
"agent": "atlas/auto/maximum",
|
||||
"agent": "atlas/auto/balanced",
|
||||
}
|
||||
assert router.PROFILE_ROUTE[router.ROUTER_PROFILE] in router.AUTO_ROUTES
|
||||
|
||||
@ -59,6 +59,25 @@ def test_auto_boundary_selects_only_a_public_switchyard_route(tmp_path, monkeypa
|
||||
assert source == "auto"
|
||||
|
||||
|
||||
def test_legacy_maximum_default_migrates_to_adaptive_agent_route(
|
||||
tmp_path, monkeypatch
|
||||
):
|
||||
path = tmp_path / "route-policy.json"
|
||||
path.write_text(
|
||||
json.dumps({"mode": "auto", "auto_route": "atlas/auto/maximum"}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
monkeypatch.setattr(router, "POLICY_PATH", path)
|
||||
|
||||
policy = router._load_policy()
|
||||
|
||||
assert policy == {
|
||||
"version": router.POLICY_VERSION,
|
||||
"mode": "auto",
|
||||
"auto_route": router.PROFILE_ROUTE[router.ROUTER_PROFILE],
|
||||
}
|
||||
|
||||
|
||||
def test_ui_priority_changes_auto_posture_without_selecting_a_target(
|
||||
tmp_path, monkeypatch
|
||||
):
|
||||
|
||||
@ -658,6 +658,11 @@ def test_legacy_state_is_archived_without_removing_provider_transcripts(tmp_path
|
||||
def test_agent_uses_one_native_kanban_control_plane():
|
||||
configmap = yaml.safe_load((HERMES / "agent-configmap.yaml").read_text())
|
||||
config = yaml.safe_load(configmap["data"]["config.yaml"])
|
||||
assert config["model"] == {
|
||||
"provider": "atlas-switchyard",
|
||||
"default": "atlas/auto/balanced",
|
||||
"model": "atlas/auto/balanced",
|
||||
}
|
||||
assert config["kanban"]["dispatch_in_gateway"] is True
|
||||
assert config["kanban"]["default_assignee"] == "cli-auto"
|
||||
assert config["plugins"]["enabled"] == ["auto-router"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user