router: bypass local routing rules for cloud-first agents

This commit is contained in:
Apple
2026-02-18 10:28:53 -08:00
parent ef59cb0950
commit 05435e7fad

View File

@@ -1463,6 +1463,12 @@ async def agent_infer(agent_id: str, request: InferRequest):
default_llm = "cloud_deepseek"
routing_rules = router_config.get("routing", [])
if agent_id.lower() in _CLOUD_FIRST_AGENT_SET and not (metadata or {}).get("force_local_model"):
# For cloud-first agents, ignore local-only routing rules unless explicitly forced.
routing_rules = [
rule for rule in routing_rules
if not (isinstance(rule.get("use_llm"), str) and not rule.get("use_llm", "").startswith("cloud_"))
]
default_llm = _select_default_llm(agent_id, metadata, default_llm, routing_rules)
# Get LLM profile configuration