Skip to main content

LLM: Gateway Model Routing

This is the implementation guide for model routing. Principles live in G.A.I.N LLM. Playbooks live under LLM. Intent dispatch and agent orchestration live in the Agents Blueprint.

THE CLAIM

The model does not choose which model runs. Task-aware routing, abstention, and the capability matrix live on the gateway, not in the agent prompt.

What you are building

A production LLM gateway is five connected capabilities on every inference call:

  1. Task signal: receive task type (plan, synthesize, classify) plus model_profile from the route
  2. Capability matrix: filter approved endpoints by task, data class, region, and entitlements
  3. Constraint score: apply cost, latency, and residency rules
  4. Endpoint pick: choose stable or canary route; abstain if no approved fit
  5. Return to the agentic app: run inference and hand the completion back to Plane ②

Plane ① on the Agents Blueprint may pin model_profile on the route row. The LLM gateway resolves that to a registry-approved endpoint.


This diagram is model routing only. It does not choose workflows (Agents Plane ①) or tools (Agents Plane ②).

Shared rules

RuleApplies to
Versioned platform configCapability matrix
Pin per session or requestModel route id
Trace every decisionModel endpoint id
CI gate on changeModel canary
LLM does not own authorityGateway registry picks endpoint

Do not collapse

Anti-patternFix
Model choice only in the system promptGateway matrix + task routing
Ad-hoc vendor URLs in app configApproved endpoints only
One LLM call routes, plans, and picks modelAgents own intent and orchestration; this blueprint owns the endpoint
Canary without an eval gateCanary promotion

What this plane decides

DecidesDoes not decide
Which approved model endpoint for this callWhich workflow or manifest (Agents Plane ①)
Cost, latency, region, data-class constraintsWhich tool to propose (Agents Plane ②)
Canary vs stable route for a task tierPEP verdict on side effects (Governance)

Playbooks

Start at LLM overview:

PlaybookOwns
Capability matrixApproved models per task, data class, region
Gateway task routingPlan vs synthesize vs classify; failover, cost, abstain
Canary promotionEval-gated model swap and rollback

model_profile on the route row is a coarse tier from Plane ① only. Inference handoff from the agentic app: Inference handoff.

Ownership

RoleOwns
AI platformLLM gateway, capability matrix
Security / IAMData-class routing rules
Domain squadsUse-case model requirements
GovernanceModel approval, canary sign-off
SRE / FinOpsGateway SLOs, cost attribution

Implementation sequence

When you have multiple models or regions: LLM playbooks in order: capability matrix → gateway task routing → canary promotion.

Eval: Reasoning plane.

Series index

Playbooks

Related