MODEL ROUTER SPEC TEMPLATE (v1) Purpose Define a stable contract between the product and any model provider. This document is the source of truth for routing, policy, telemetry, and change control. 1) Supported Providers + Models - Provider list: (e.g., OpenAI, Anthropic, Google) - Allowed model identifiers per provider - Default model per capability (drafting, extraction, classification, code, summarization) - Fallback order per capability 2) Request Contract (Inputs) - Message format (roles allowed, max message count) - System instruction ownership: which team can change it, where it lives - Tool schema registry: name, input JSON schema, output schema - Retrieval payload format: query, doc IDs, snippet text, metadata fields - Redaction: what is removed or masked before sending to provider 3) Response Contract (Outputs) - Required fields: final_text, structured_json (if applicable), citations[], tool_trace[], refusal_reason - JSON schema rules (strict/loose), and what happens on violation - Citation rules: when required, allowed sources, formatting 4) Policy Layer - Tenant policies: tools allowed, data residency constraints, citation requirements - Content policies: disallowed tasks, escalation rules, refusal taxonomy - Prompt-injection defenses: tool allowlist, instruction hierarchy, sensitive string filters - Human-in-the-loop gates: which tool calls require approval 5) Routing Rules - Capability-based routing: which model for which task type - Context-based routing: long context vs short; tool-heavy vs no-tools - Degrade modes: no tools, no retrieval, smaller model, “summarize only” - Timeouts, retries, and circuit breaker conditions (schema failures, tool loops, refusal spikes) 6) Telemetry + Audit Log per request (minimum): - request_id, tenant_id, user_id (or anonymized ID) - provider, model, model_version if available - policy bundle applied (policy ID/version) - retrieval trace: doc IDs/snippet IDs used - tool calls: names, inputs (redacted), outputs (redacted) - outcome: latency, errors, schema_valid, user feedback event Retention rules and access controls for logs. 7) Evaluation + Release Control - Golden set definition: where examples come from, redaction rules - Offline eval cadence and ownership - Canary process: traffic percent, success criteria, rollback triggers - Change log: every model/prompt/policy change requires an entry with date + owner 8) Security Checklist (Ship/No-Ship) - Tools cannot access unscoped credentials - All tool calls validated against schema - PII redaction tested with real examples - Request tracing enabled in production - Fallback mode tested (provider outage simulation) How to Use - Put this file in your repo. - Assign owners: Product (policy), Engineering (routing + telemetry), Security/Legal (data handling). - Treat changes like API changes: review, canary, and document.