The principle: compliance is a filter, cost is a sort
Policy is evaluated first and acts as a hard constraint. Cost is an optimization that applies only within the set of models that policy permits. A model that policy excludes is never a candidate, however low its price.
Decision order for every request
The decision flow runs in four steps, in this order, for every request.
- ClassifyAssign data class, residency, and use case attributes.
- FilterRemove every model that policy does not permit.
- RankSelect the lowest-cost model among the eligible set.
- RecordLog the inputs, policy result, and chosen model.
Classify requests and build the eligibility registry
Classification assigns data class, residency, and use case attributes to each request. Policy then compares those attributes with the eligibility registry to decide which models remain in the eligible set.
What each registry entry records
- Hosting and processing regions, including where logs and backups reside
- Data retention terms for prompts and outputs
- Whether provider terms permit training on customer data
- Certifications and attestations the provider documents, with the verification date
- Data classes the model is approved to receive
- Approved use cases, contract status, and the internal owner of the entry
Fallback, failure, misclassification, and drift
Fallback is limited to the eligible set, so a substitute model must pass the same policy checks as the first choice.
Each outcome is recorded as dispatched, fallback used, queued, or rejected, with the fallback reason. The policy version and registry version used for each decision are recorded alongside it.
Routing audit record
The final step of the decision order is to record the decision. Each routing audit record includes:
- Request ID, timestamp, calling application, and user or agent identity
- Assigned classification attributes and how each was derived
- Policy version and registry version used for the decision
- Eligible models considered, with the reason for each exclusion
- Selected model, region, and cost basis for the choice
- Outcome: dispatched, fallback used, queued, or rejected, with the fallback reason