14A.1 Approved Providers, Models and Regions
The first thing a new AI engineer at a company discovers is that "which model can I use?" is not a technical question. It is a policy question with a technical answer. The model that scores best on your eval set may belong to a provider whose contract your legal team has not signed. The cheapest endpoint may process data in a region your customers' contracts forbid. The model you built the prototype on may be scheduled for retirement before the feature ships. Most organizations answer these questions once, in writing, in an approved providers, models and regions standard, so that every engineer does not have to rediscover the answers (or, worse, skip them). This lesson teaches you what such a standard should contain and why, how to read one, how to work within one, how to ask for an exception when it blocks real work, and how to test that your code actually obeys it. It is a template lesson: the general practice is written out in full, and every fact that only your organization knows (the actual list, the actual regions, the actual approvers) is marked as a placeholder for the organization to fill in. Where you see a filled-in sample, it belongs to a fictional company called Northwind Analytics and is clearly labelled as an example.
What you'll learn
- Why organizations restrict providers, models and regions, and what risks the restriction manages
- The criteria a provider must meet before approval (data handling, retention, residency, zero data retention, contract terms, security attestations, pricing and limits, licensing) and where each piece of evidence lives
- What a model registry record contains, and why approving a provider is not the same as approving a model
- How to reason about regions: data residency, processing location and access location are three different things
- How an allowlist and a denylist work, why "default deny" is the safe default, and the four layers where a list can be enforced
- How to request an exception, and what a good exception record looks like
- How model lifecycle and deprecation fit into the approval standard
- How to build and run a small policy checker, and how to design a policy-compliance eval set
What you don't need
- API keys. The only code in this lesson is a pure Python standard-library script that checks requests against a policy file. It never calls a model.
- Docker, databases or any local service.
- Legal training. You are learning to read and apply a standard, not to write contracts. Where a decision is genuinely legal, the lesson says who to ask.
Setup
No installs. You need Python 3.11 or later and a text editor. All volatile facts in this lesson are written "as of 1 December 2026" and should be re-checked on the official pages named in Part 2 before you rely on them.
mkdir -p policy_kit && cd policy_kit
# save the script from Part 6 as model_policy.py
python3 model_policy.py 2026-12-01What you must be able to do after this lesson#
- Explain which risks a provider, model and region restriction manages
- Check a provider against approval criteria such as retention, residency and zero data retention
- Explain why approving a provider is not the same as approving a model
- Distinguish data residency, processing location and access location
- Apply a default-deny allowlist and name the four layers where it can be enforced
- Write an exception request that records the reason, the risk and an expiry date
Why this matters for an AI engineer#
You will hear this vocabulary in your first week. Each phrase points at a decision that someone has already made for you, and that you need to be able to read, apply and challenge.
| You'll hear... | You'll understand it after... |
|---|---|
| "Is that provider on the approved list?" | Part 2 and 5.1 |
| "That model isn't in the registry yet." | 3.2 What a registry record holds |
| "Pin the snapshot, don't use the alias." | 3.3 Aliases and pinned snapshots |
| "Is that EU-only processing?" | 4.1 Three different locations |
| "Does it have ZDR?" | 2.2 Retention and zero data retention |
| "Where's the DPA for that vendor?" | 2.5 Contract terms |
| "Go through the gateway, not direct." | 5.2 Four enforcement layers |
| "File an exception and time-box it." | Part 7 |
| "That model retires next quarter." | 3.4 Lifecycle and deprecation |
Part 1: Why the list exists#
1.1 The risks a list manages#
A company that uses language models is exposed to risks that do not show up in a benchmark. Each risk has an owner outside engineering, which is why the standard is usually written jointly by engineering, security, legal and procurement.
| Risk | What goes wrong | Who usually owns it |
|---|---|---|
| Data exposure | Customer or employee data is sent to a provider that stores it, trains on it, or lets staff read it | Security, privacy, legal |
| Residency and transfer | Data crosses a border it is not allowed to cross under law or customer contract | Legal, privacy |
| Contract gaps | No data processing agreement, no liability terms, no right to audit | Legal, procurement |
| Reliability | One provider outage stops a product, and there is no tested fallback | Engineering, SRE |
| Cost | Unbounded spend on an expensive model, or a surprise price change | Finance, engineering |
| Lifecycle | A model is deprecated and retired, and a feature breaks | Engineering |
| Licensing | An open-weight model's licence forbids your use case, or a generated output carries restrictions | Legal |
| Security of the supply chain | A malicious or compromised model, SDK or gateway | Security |
| Sprawl | Twenty teams use twenty providers, and nobody can answer "where does our data go?" | Architecture, security |
The last row matters more than it looks. When something goes wrong (a provider reports a breach, a regulator asks a question, a customer audits you), the first question is always "which of our systems send data to that provider?". If the answer is "we do not know", the incident starts with a week of archaeology. An approved list turns that week into a query.
1.2 What an approved list actually is#
An approved list is more than one table. A useful standard has three layers, and each answers a different question:
- Providers. Who may receive our prompts at all? This layer is about contracts, security evidence and data handling.
- Models. Which specific models from those providers may we use, for which purposes? This layer is about capability, cost, lifecycle and licensing.
- Regions and data classes. For which kinds of data, and in which locations, may each approved provider and model be used? This layer connects the list to the data classification in 14A.3.
The three layers compose. A request is allowed only if the provider is approved, the model is approved, the region is approved for that provider, and the data class is allowed for that combination. The script in Part 6 implements exactly that chain.
1.3 Who decides, and how it stays current#
Approval is a process with named owners, not a vibe. The usual shape is a small review group (security, privacy, legal, an engineering lead, sometimes finance) that evaluates a provider against the criteria in Part 2, records the decision, and sets a review date. Reviews recur because the facts change: providers change their retention terms, add regions, pass or lose attestations, deprecate models and change prices.
A good standard also states what happens when evidence goes stale. For example: "an approval that has not been reviewed within the review period becomes provisional, and new projects may not start on it until it is re-reviewed". That sentence protects the organization from a list that was accurate in one quarter and fiction two years later.
Part 2: Provider approval criteria and where to find the evidence#
Before an organization approves a provider, it asks the same handful of questions every time. The questions are general. The answers belong to each provider and change over time, so a good approval record stores the evidence (a link, a document, a date) next to each answer, not just a tick.
2.1 Data handling and training#
The first question is what the provider does with the data you send. Three sub-questions:
- Is your data used to train or improve models? For paid API products, the major providers state that API data is not used for training by default, but terms differ between API, consumer chat apps, free tiers and enterprise products. The same company can have a safe product and an unsafe one.
- Can humans read it? Some free tiers and abuse-review processes allow human review of content.
- What does the provider do with metadata? Token counts, timestamps and account identifiers are usually kept even when content is not.
The most common beginner mistake is confusing products. The free tier of a model API and the paid tier of the same API can have different data terms. A consumer chat app is a different product again. A standard should therefore name the product and tier that is approved, not only the company.
12.4 holds a dated snapshot of what OpenAI, Anthropic, Google and OpenRouter say about training and retention, and 02.9 owns the checklist of questions. Treat those as a starting point and verify on the provider's own pages on the day of the review.
2.2 Retention and zero data retention#
Even when a provider does not train on your data, it may retain it for a period, for example for abuse monitoring, safety classifiers, stored conversation state, files, caches or batch inputs. The criteria to record:
| Question | Why it matters |
|---|---|
| How long are prompts and outputs retained by default? | Sets the longest time your data sits outside your control |
| Are some features retained longer than the base API (stored responses, files, vector stores, batch jobs, fine-tuning data)? | A "no retention" claim for the base endpoint may not cover the feature you actually use |
| Is zero data retention (ZDR) available, how do you get it, and which features are excluded? | ZDR is normally a contract or account-level arrangement, not a request flag |
| Are flagged-content exceptions documented? | Safety systems may keep flagged content longer |
Zero data retention means the provider does not store prompts and outputs beyond what is needed to serve the request. It is usually something you apply for and have confirmed in writing, and it often excludes some features. So "we have ZDR" is only a complete statement when it names the endpoints it covers. As the 12.4 snapshot puts it, ZDR is a contract, not a flag, and if your compliance position needs it, procurement starts months before launch.
2.3 Residency, processing location and subprocessors#
Where does the provider process and store data, and which other companies touch it? The questions:
- Which regions can inference run in? Can you pin a region?
- Where are logs and any retained data stored?
- Which subprocessors (other companies the provider uses, such as a cloud host) are involved, and how are you told when they change?
- Does support staff access cross borders?
Part 4 returns to this, because the answer depends on exactly which of three meanings of "location" you care about.
2.4 Security attestations and where to check them#
Providers prove their security practices with independent reports and certifications. The ones you will meet most often:
| Evidence | What it tells you | Notes |
|---|---|---|
| SOC 2 Type II report | An auditor tested the provider's controls (security, availability, confidentiality and so on) over a period of time | Type I is a point in time; Type II covers a period and is the stronger evidence. Check the report period and scope |
| ISO/IEC 27001 certificate | The provider runs a certified information security management system | Check the scope statement: it may cover only part of the company |
| ISO/IEC 42001 certificate | The provider runs a certified AI management system | Newer than 27001; fewer providers hold it |
| HIPAA support (a business associate agreement) | The provider will sign a BAA, needed if you handle US protected health information | A BAA is a contract; the provider must also say which products are in scope |
| Penetration test summaries, security whitepapers | Extra assurance and architecture detail | Often available under NDA |
| Cloud-provider compliance reports | If the model runs on a cloud platform, the cloud's attestations may apply | Check which model-hosting service is in scope |
Where to check: almost every serious provider runs a trust portal (sometimes called a trust center or security page) where customers request the reports, usually under NDA. Check the provider's security page, the trust portal, and the contract itself. For cloud-hosted models, check the cloud provider's compliance documentation for the specific model service, because the certified scope may not include every product.
2.5 Contract terms: DPA, BAA, indemnity and SLA#
| Term | What it is | Why it matters |
|---|---|---|
| DPA (data processing agreement) | A contract under which the provider processes personal data only on your instructions | Required under GDPR when a vendor processes personal data for you (Article 28), and standard practice elsewhere |
| BAA (business associate agreement) | The US HIPAA contract for vendors that handle protected health information | Needed before any health data goes to a vendor |
| IP indemnity | The provider's promise to defend you against some intellectual-property claims about outputs | Terms and exclusions differ; legal must read them |
| SLA (service level agreement) | Promised availability and support response, often with credits | Many API products offer no uptime guarantee on standard terms; enterprise tiers differ |
| Liability cap, audit rights, breach notification | Who pays, whether you can inspect, how fast you are told | Legal and security negotiate these |
An engineer does not negotiate these, but must know which ones exist for a provider, because the answer changes what data may be sent (see Part 4).
2.6 Pricing, limits and commercial fit#
Pricing belongs in the standard for a surprising reason: a model nobody can afford at scale is a model nobody should build a product on. Record, with a date, the price per unit (usually per million input and output tokens), the rate limits, the batch and caching discounts, and who pays (central budget or the team). 02.9 and 11B.2 cover how to read and compare prices. Prices are volatile: write the date next to every number, and never copy a price into a policy file without the date.
2.7 Licensing, especially for open-weight models#
Open-weight models (whose weights you can download) are approved on different evidence, because there is no vendor contract. Instead you check the licence: does it allow commercial use, does it restrict certain uses or industries, does it require attribution or a notice, does it place conditions on derived models? You also check provenance (where the weights came from and whether the files are verified), the safety of the file format, and who will run and patch the serving stack. 11C.6 calls the licence "the deployment gate", and 12.7 covers provenance and supply-chain checks.
2.8 The criteria table: a summary#
| Criterion | Evidence to store | Where to check |
|---|---|---|
| Training on your data | Terms for the exact product and tier | Provider terms and data-usage pages |
| Retention | Default period and per-feature exceptions | Provider data-retention documentation |
| ZDR | Written confirmation and the endpoints it covers | Contract, account manager |
| Residency and subprocessors | Region list, subprocessor list, change-notification method | Provider documentation, DPA annex |
| SOC 2 / ISO 27001 / ISO 42001 | Report or certificate, period, scope | Trust portal, certification body register |
| DPA / BAA | Signed copy and date | Contract repository |
| IP indemnity | Clause and exclusions | Contract, legal review |
| SLA and limits | Uptime commitment, rate limits | Contract, provider status and limits pages |
| Price | Price list with date | Provider pricing page |
| Licence (open weights) | Licence text and review notes | Model repository |
Part 3: Approving models, and the model registry#
3.1 Provider approval is not model approval#
An approved provider is the necessary starting point. It is not enough, because each model has its own properties. A model may be:
- approved only for low-risk data, because it is a preview release with no contractual commitments;
- approved only for internal use, because its safety behaviour has not been tested for customer-facing use;
- unavailable in a required region;
- scheduled for retirement soon;
- too expensive for the use case, even though it is safe.
So the standard approves models separately, usually with a status (for example proposed, approved, restricted, deprecated, retired) and a list of approved purposes.
3.2 What a registry record holds#
A model registry is the single table (or file) where the organization records its approved models. A registry that engineers will actually use is short, structured and kept next to the code. A record usually holds:
| Field | Example (fictional) | Why |
|---|---|---|
model_id |
model-a-large-20260301 |
The exact pinned identifier your code sends |
provider |
provider-a |
Links to the provider approval |
status |
approved |
Gate for new work |
approved_for |
internal-tools, customer-support-drafts |
Purpose limit |
max_data_class |
confidential |
Links to the data classification |
regions |
eu, us |
Where it may run |
retires |
2027-03-01 |
Lifecycle date from the provider's deprecation page |
replacement |
model-a-large-next |
Where to go next |
eval_evidence |
link to the run that justified approval | Proof it works for our use |
owner and reviewed |
role and date | Accountability and freshness |
The eval_evidence field matters. Approving a model because "it is good" is a guess. Approving it because it passed a defined eval set on your tasks (see Part 8 and 10A.8) is evidence. 11B.5 covers how to compare models fairly.
3.3 Aliases and pinned snapshots#
Most providers offer two kinds of model name. A pinned snapshot is a dated identifier that refers to a fixed model version. An alias is a moving name that points at the latest version and can change behaviour without any code change on your side. For production, standards almost always require pinned snapshots, because an alias means "the model you tested last quarter may not be the model that runs today". For experiments, aliases are fine.
The registry should therefore list pinned identifiers. A code reviewer can then check, in seconds, that the model string in a pull request exactly matches a registry entry (14A.2 turns this into a review step).
3.4 Lifecycle and deprecation#
Models are not permanent. Providers publish deprecation and retirement schedules, usually with a minimum notice period, and requests to a retired model fail. Some providers also reroute deprecated names to a newer model, which keeps your code running but changes behaviour and sometimes billing, as 14A.9 shows with a dated example. A good standard therefore includes:
- a review trigger: when a provider announces a deprecation, the registry entry gets a
retiresdate within a set number of working days; - a migration window: affected owners must migrate, with an eval comparison, before a set date ahead of retirement;
- a block on new work: once a model is deprecated, new projects may not start on it;
- a sweep: a scheduled check that searches code and config for any model identifier that is deprecated or not in the registry.
11C.5, Model lifecycle on one page is the general reference for vocabulary such as deprecated, retired and rerouted. 11C.2 Part 8 carries the model-upgrade playbook, and 14A.9 shows how to read provider deprecation pages.
3.5 A filled-in sample registry (fictional)#
EXAMPLE ONLY. The following belongs to a fictional company, Northwind Analytics. Names, dates and rules are invented to show the shape. Do not copy them. Your organization's real entries replace this block.
# northwind-model-registry.yaml (EXAMPLE, fictional)
providers:
provider-a:
status: approved # reviewed 2026-09-10 by the model review group
zdr: true # confirmed in writing, covers the chat and embeddings endpoints
max_data_class: restricted
regions: [eu, us]
attestations: ["SOC 2 Type II (period ended 2026-06-30)", "ISO/IEC 27001"]
dpa: signed
provider-b:
status: approved
zdr: false
max_data_class: internal
regions: [us]
dpa: signed
provider-c:
status: denied
reason: no DPA available
models:
model-a-large-20260301:
provider: provider-a
status: approved
approved_for: [internal-tools, customer-support-drafts]
retires: 2027-03-01
eval_evidence: run-2026-08-22-a
model-a-small-20260301:
provider: provider-a
status: approved
approved_for: [classification, routing]
retires: 2026-12-20 # warning: inside the migration windowPart 4: Regions and data residency#
4.1 Three different locations#
"Is it in the EU?" can mean three different things, and standards that blur them cause real mistakes.
| Meaning | Question | Example risk |
|---|---|---|
| Data residency (at rest) | Where is stored data (logs, files, vector stores, retained prompts) kept? | A retained log sits in a region you did not agree to |
| Processing location (in transit and in use) | In which region does the model actually run inference on your prompt? | A request from an EU app is processed in another region |
| Access location | From where can the provider's staff or subprocessors access the data? | Support engineers elsewhere can open a case that contains your data |
A provider can offer regional storage but global processing, or regional processing with global support access. The standard has to say which of the three it requires for each data class, and the approval record must state which of the three the provider actually offers.
4.2 How regional control is offered#
In practice you will see a few patterns:
- Regional endpoints or regional projects. The provider offers separate endpoints per region, and you choose one.
- Cloud platform model services. A cloud provider hosts a model, and you select the cloud region. The cloud's data-processing terms usually apply. Check which model service is covered by which attestations (02.9 Part 9 explains how the data processor changes).
- Cross-region routing. Some services route a request to whichever region has capacity, which is convenient and can break a residency rule. Treat "automatic cross-region" as a setting to review, not a default to accept.
- Self-hosted open weights. You choose the region by choosing where you run the servers (11C.6).
- Gateways. A gateway in front of providers can add a processing hop and a new data processor. 11C.3 covers the engineering; for approval purposes the gateway is itself a provider that needs reviewing.
4.3 A decision matrix: data class by provider and region#
The practical output of this work is a matrix. Rows are data classes (14A.3 defines them). Columns say what is allowed.
EXAMPLE ONLY (fictional company, Northwind Analytics). Real rules differ per organization.
| Data class | External provider allowed? | Region rule | Retention rule | Extra condition |
|---|---|---|---|---|
| Public | Yes, any approved provider | Any approved region | Any | None |
| Internal | Yes, approved providers | Approved regions | Provider default is acceptable | Paid tier only, never free tier |
| Confidential | Yes, providers with signed DPA | EU or US as approved | Provider retention at most the stated limit | Redact personal data before sending |
| Restricted | Only providers with ZDR, or self-hosted | Region pinned, no cross-region | ZDR required | Security review per use case |
4.4 Common residency traps#
- The free tier. Some providers use free-tier content to improve their products. Development and throwaway work only.
- Embeddings and files. A team approves the chat model but forgets that vector stores, uploaded files and batch inputs are stored in a region too.
- Logs and traces. You may send nothing sensitive to the model and still copy full prompts into a US-hosted tracing tool. Your own observability stack is a data location too (11A.1, and 14A.3).
- Fallbacks. A fallback chain that quietly falls through to a provider in another region breaks the rule only during outages, which is exactly when nobody is looking.
- Subprocessor changes. A provider adds a subprocessor, and your approval is now out of date. The approval record needs a way to learn about changes.
Part 5: Allowlists, denylists and enforcement#
5.1 Default deny: allowlists and denylists#
An allowlist names what is permitted. A denylist names what is forbidden. They are not equivalent. The safe pattern is default deny: anything not on the allowlist is not allowed. A denylist alone fails whenever something new appears, and in this field something new appears every month. Use a denylist as an addition, for explicit decisions the organization wants on record ("provider C was reviewed and rejected, here is why"), so nobody re-proposes it without new evidence.
Both lists need three things beyond the names: a reason, an owner and a date.
5.2 Four enforcement layers#
A written standard is a request. Enforcement makes it real. The strongest setups use several layers, because each catches different mistakes:
| Layer | What it catches | Weakness |
|---|---|---|
| 1. Code review and CI | A pull request that adds an unapproved model string, provider SDK or endpoint URL | Only checks what is in the repository |
| 2. The shared client or wrapper | Calls go through one internal function that refuses unapproved model and region combinations | Teams can bypass it unless layer 3 closes the door (03.11 shows the provider-agnostic client pattern) |
| 3. The gateway | All provider traffic passes through one controlled point that holds the keys, enforces the lists, logs and budgets (11C.3) | A single point of failure and a processor you must also approve |
| 4. Network and key controls | Production networks can reach only approved hosts; provider keys are issued only to the gateway | Needs platform-team support |
A useful rule of thumb: put the policy in one place as data (a file the checker reads), and let each layer read the same file. If layer 1 and layer 3 each hold their own copy of the allowlist, the copies drift apart.
5.3 Open-weight and self-hosted models in the standard#
Open weights do not escape the standard. They change the evidence. The standard should say who may serve open models, which registries the weights may be downloaded from, how the files are verified, which licences are acceptable, and how the served endpoint is registered so it appears in the same registry as hosted models. 11C.6 covers the serving side and 12.7 the supply-chain side.
5.4 Keeping code portable#
The approved list will change. Providers get added, retired and replaced. The best protection is code that does not hard-code a provider: a thin client that takes a provider and model from configuration, so that moving from one approved model to another is a config change plus an eval run (03.11). The same portability makes exceptions cheap to end. When a time-boxed exception expires, you switch the config back.
Part 6: Try it: a policy checker you can run#
Deep-dive
This script reads a small policy (providers, models, regions, data classes) and checks requests against it. It is the same chain of checks described above. It uses only the standard library, calls no model, and the policy inside it is a fictional example. In a real setup the policy would live in a separate file owned by the standards group, and the same checker would run in CI.
"""model_policy.py: check a model request against an allowlist policy.
Standard library only. The policy below is a FICTIONAL example (Northwind Analytics)."""
from __future__ import annotations
import json
import sys
from datetime import date
POLICY = json.loads("""
{
"data_classes": ["public", "internal", "confidential", "restricted"],
"providers": {
"provider-a": {"status": "approved", "zdr": true, "max_class": "restricted", "regions": ["eu", "us"]},
"provider-b": {"status": "approved", "zdr": false, "max_class": "internal", "regions": ["us"]},
"provider-c": {"status": "denied", "reason": "no DPA available"}
},
"models": {
"model-a-large-20260301": {"provider": "provider-a", "status": "approved", "retires": "2027-03-01"},
"model-a-small-20260301": {"provider": "provider-a", "status": "approved", "retires": "2026-12-20"},
"model-b-mid-20260115": {"provider": "provider-b", "status": "approved", "retires": null},
"model-a-large-20250101": {"provider": "provider-a", "status": "retired", "retires": "2026-06-01"}
}
}
""")
RANK = {name: i for i, name in enumerate(POLICY["data_classes"])}
def check(request: dict, today: date) -> dict:
"""Return {"decision": allow|deny|exception, "reasons": [...], "warnings": [...]}."""
reasons, warnings = [], []
model = POLICY["models"].get(request["model"])
if model is None:
return {"decision": "exception", "reasons": [f"model {request['model']!r} is not in the registry"], "warnings": []}
provider = POLICY["providers"][model["provider"]]
if provider["status"] != "approved":
reasons.append(f"provider {model['provider']} is {provider['status']}: {provider.get('reason', 'no reason recorded')}")
if model["status"] != "approved":
reasons.append(f"model status is {model['status']}")
if model["retires"]:
days = (date.fromisoformat(model["retires"]) - today).days
if days < 0:
reasons.append(f"model retired on {model['retires']}")
elif days <= 60:
warnings.append(f"model retires in {days} days ({model['retires']}): plan the migration")
if provider["status"] == "approved":
if request["region"] not in provider["regions"]:
reasons.append(f"region {request['region']!r} is not approved for {model['provider']}")
if RANK[request["data_class"]] > RANK[provider["max_class"]]:
reasons.append(f"{request['data_class']} data exceeds the {provider['max_class']} ceiling for {model['provider']}")
if request["data_class"] == "restricted" and not provider["zdr"]:
reasons.append("restricted data requires zero data retention")
return {"decision": "deny" if reasons else "allow", "reasons": reasons, "warnings": warnings}
if __name__ == "__main__":
today = date.fromisoformat(sys.argv[1]) if len(sys.argv) > 1 else date.today()
requests = [
{"id": "R1", "model": "model-a-large-20260301", "region": "eu", "data_class": "confidential"},
{"id": "R2", "model": "model-b-mid-20260115", "region": "us", "data_class": "confidential"},
{"id": "R3", "model": "model-a-small-20260301", "region": "us", "data_class": "internal"},
{"id": "R4", "model": "model-a-large-20250101", "region": "eu", "data_class": "public"},
{"id": "R5", "model": "model-x-new", "region": "eu", "data_class": "public"},
]
for r in requests:
out = check(r, today)
print(f"{r['id']} {r['model']} / {r['region']} / {r['data_class']}: {out['decision'].upper()}")
for line in out["reasons"]:
print(f" reason: {line}")
for line in out["warnings"]:
print(f" warning: {line}")Run it with a fixed date so the output is repeatable:
python3 model_policy.py 2026-12-01Real output:
R1 model-a-large-20260301 / eu / confidential: ALLOW
R2 model-b-mid-20260115 / us / confidential: DENY
reason: confidential data exceeds the internal ceiling for provider-b
R3 model-a-small-20260301 / us / internal: ALLOW
warning: model retires in 19 days (2026-12-20): plan the migration
R4 model-a-large-20250101 / eu / public: DENY
reason: model status is retired
reason: model retired on 2026-06-01
R5 model-x-new / eu / public: EXCEPTION
reason: model 'model-x-new' is not in the registryRead the output as a reviewer would:
- R1 passes every link in the chain.
- R2 fails on the data-class ceiling even though the provider is approved. This is the "approved provider is not approved for everything" case.
- R3 is allowed but warns about an approaching retirement. Warnings are how a policy nudges engineers before a hard failure.
- R4 shows two reasons at once. A good checker returns all reasons, so the engineer fixes everything in one go.
- R5 is not denied; it is an exception because the model was never reviewed. That distinction matters. A denial is a decision. An unknown model is a missing decision, and the right response is to start the request process (Part 7).
6.1 Where to run it#
A checker only helps when it runs where mistakes happen. Three common places: as a unit test that loads every model identifier found in the repository's configuration files and checks it; as a CI step on pull requests (11C.2 covers the CI mechanics); and inside the shared client or gateway at call time, as the last line of defence. 14A.2 shows the PR-description side of this process.
Part 7: Exceptions: asking for what the standard does not allow#
Deep-dive
7.1 Why exceptions must exist#
Standards that cannot bend get ignored. A team with a genuine need (a new provider that is clearly better for a task, a pilot with a tight deadline, a research spike) will route around a standard that offers no legitimate path. A good standard therefore includes an exception process that is quick enough to be used and strict enough to be safe.
7.2 What a good exception request contains#
| Field | What to write |
|---|---|
| What you want | The exact provider, model, region, data class and purpose |
| Why the approved list does not work | A specific reason, backed by evidence such as an eval comparison |
| Data involved | The data class, and whether real personal data is used |
| Risk and mitigations | Redaction, a synthetic-data pilot, restricted access, short retention |
| Duration | A start and an end date (exceptions are time-boxed) |
| Owner | One accountable person |
| Exit plan | How you move back to an approved option when the exception ends |
| Approval | Who signed, and when |
Two habits make exceptions work. First, time-box them: an exception without an end date becomes a permanent rule nobody reviewed. Second, log them: a register of live exceptions lets the review group see patterns. If five teams all ask for the same provider, that is a signal to review the provider properly and add it to the list.
7.3 A sample exception record (fictional)#
EXAMPLE ONLY. Northwind Analytics is fictional. The values are invented.
exception_id: EX-0042
requested_by: pat.example # fictional person
provider: provider-d # not yet reviewed
model: model-d-vision-20261101
region: us
data_class: public # pilot uses published product images only
purpose: compare image-labelling quality on a public dataset
justification: approved vision models score below 0.70 on our label set; see run-2026-11-20-c
mitigations: [public data only, no customer data, keys stored in the team vault]
starts: 2026-12-01
ends: 2027-01-31
exit_plan: remove provider-d from config; keep results as a report
approved_by: model review group # filled by the approverNotice how the data class is public and the pilot uses no customer data. The smaller the risk you propose, the faster the approval. Engineers who want exceptions to be approved quickly should shrink the blast radius first and ask second.
7.4 Requesting access and budget#
Approval of a model does not give you a key or a budget. That is a separate step: you request access to the approved model and a spending limit for your project. That process is the subject of 14A.4 (Requesting Model Access and Budget).
Part 8: Evaluate it: a policy-compliance eval set#
Deep-dive
Policies fail quietly. Nobody notices that a new service calls an unapproved region until an auditor asks. So treat compliance like any other behaviour of your system: write a small eval set and run it on every change. This part designs a tiny one. It uses ideas from 10A.2 (datasets), 10A.3 (deterministic code graders) and 10A.8 (regression gates).
8.1 What are we testing?#
Two different things, and they need different tests.
- The checker is correct. Given a request, does
model_policy.py(or your gateway) decide the way the standard says? This is classic deterministic testing. - The system obeys the policy. Given the real configuration of your services, does every model identifier, provider and region in use appear in the registry and satisfy the rules? This is a conformance scan.
8.2 Design of the eval set#
Build a table of cases. Each case has an input (a request) and an expected decision. Include the boundaries, because boundaries are where policies break.
| Case | Input | Expected |
|---|---|---|
| allow-basic | approved model, approved region, public data | allow |
| ceiling-exceeded | approved provider, data class above its ceiling | deny |
| region-not-approved | approved model, region not on its list | deny |
| zdr-required | restricted data, provider without ZDR | deny |
| unknown-model | model string not in the registry | exception (not allow) |
| retired-model | model past its retirement date | deny |
| retiring-soon | model within the warning window | allow with warning |
| alias-used | a moving alias instead of a pinned snapshot | deny or warn, per the standard |
| denied-provider | provider on the denylist | deny, with the recorded reason |
| fallback-region | fallback target in a non-approved region | deny |
Add one case per rule in the standard. When the standard changes, add a case first. Keep the set small (twenty to fifty cases) and in version control next to the policy file.
8.3 Metric and pass rule#
| Layer | Metric | Pass rule |
|---|---|---|
| Checker correctness | exact-match accuracy of decision on the case table | 100 percent: policy decisions are deterministic, so any mismatch is a bug |
| Reason quality | each denial lists at least the expected reason string | 100 percent on denials |
| Conformance scan | count of model identifiers in config not in the registry | 0 |
| Warnings | number of models within the retirement window with no owner assigned | 0 |
| Gateway (if used) | share of provider calls in a sampled log that came through the approved path | 100 percent |
Why 100 percent and not 95? Statistical thresholds suit fuzzy model outputs. A policy checker is plain code with rules, so a failing case is a defect, not noise. (Reserve percentage thresholds for the model-based parts of your system.)
8.4 A minimal runner#
You can implement the case table as a list of dictionaries and loop over it, exactly like the demo in Part 6, asserting the decision for each. No framework is required for this level. When the cases grow, or when you want the same suite to cover a model-graded step (for example an assistant that answers questions about the policy), use an eval framework: the DeepEval lessons (10B.2, 10B.3, 10B.4, 10B.5, 10B.6, 10B.7) show how to define datasets, custom metrics and CI gates, and the optional Inspect lessons show the same ideas in a second framework: 10B.8 (optional), 10B.9 (optional), 10B.10 (optional) and 10B.17 (optional) for choosing between them. Tests of agent behaviour are covered by 10A.7.
For an assistant that explains the policy (a "policy chatbot"), add model-graded cases: ask "may I send customer emails to provider B?" and check that the answer matches the registry and cites the right rule. Any answer that says "yes" when the standard says "no" is a critical failure, so give that case a hard-fail rule rather than an average score.
Common misconceptions#
- "An approved provider means any of its models and any data are fine." Approval is layered: provider, model, region and data class each need to pass.
- "A SOC 2 report means the provider is safe for our use." The report has a scope and a period. Read both, and check that your product is inside the scope.
- "No training means no retention." The provider may still keep copies for monitoring, safety or features. Retention is a separate question.
- "EU region means EU law only." Residency, processing and access are three different locations, and legal transfer rules are a separate analysis.
- "A denylist is enough." A denylist only blocks what someone has already thought of. Default deny blocks what nobody has thought of yet.
- "Using an alias is fine because it always points to the best model." An alias can change behaviour silently. Production needs pinned snapshots and an eval run on every move.
- "Exceptions mean the standard failed." A visible, time-boxed exception process is a sign the standard works, because the alternative is silent workarounds.
Key takeaways#
- Provider, model, region and data class are four separate approvals that compose into one decision.
- Approval criteria are the same every time: data handling, retention and ZDR, residency and subprocessors, attestations, contract terms, price and limits, licence. Store the evidence and the date next to each answer.
- A model registry records pinned model identifiers with status, purpose, data ceiling, regions, retirement date and eval evidence.
- Default deny. Use denylists only to record explicit rejections and reasons.
- Enforce at several layers (review and CI, shared client, gateway, network and keys), all reading one policy file.
- Exceptions must exist, be time-boxed and be logged. Shrink the risk before you ask.
- Lifecycle is part of approval: record retirement dates, set a migration window and sweep for deprecated identifiers.
- A policy-compliance eval set (checker cases plus a conformance scan) gives you evidence that the policy is obeyed.
Terms introduced in this lesson#
| Term | Meaning |
|---|---|
| Approved list (allowlist) | The explicit set of providers, models and regions that may be used |
| Denylist | An explicit record of rejected providers or models, with reasons |
| Default deny | The rule that anything not on the allowlist is not allowed |
| Model registry | The table or file recording approved models with status, limits and lifecycle dates |
| Pinned snapshot | A dated model identifier that refers to a fixed version |
| Alias | A moving model name that points at a changing version |
| Data residency | Where stored data is kept |
| Processing location | The region where a model runs inference on a request |
| Zero data retention (ZDR) | An arrangement under which the provider does not store prompts and outputs beyond serving the request |
| DPA | Data processing agreement: a contract for processing personal data on your instructions |
| BAA | Business associate agreement: the US HIPAA contract for handling health data |
| SOC 2 Type II | An audit report on a provider's controls over a period of time |
| Subprocessor | A company a provider uses to process your data on its behalf |
| Exception record | A time-boxed, approved record of an allowed departure from the standard |
| Conformance scan | A check that every model, provider and region in use appears in the registry |
Exercises#
- Read a standard. Find your organization's approved list (or, if you are an external learner, the nearest equivalent, such as a cloud account's allowed model list). Write down for one provider: product and tier, retention, ZDR status, regions and the data classes it may receive. Hint: if you cannot find one of these facts, that is a finding, not a failure. Note which fact is missing and who would know.
- Extend the checker. Add a rule to
model_policy.pythat denies use of a moving alias (a model name without a date) in production. Add three cases to the eval table. Hint: represent each model as pinned or alias in the registry and add a"environment"field to the request. - Write a registry entry. Choose a model you have used in this path. Fill every field from the registry table in 3.2 using the provider's official documentation. Mark any field you cannot verify as "unverified" with the date. Hint: the retirement date comes from the provider's deprecation page, not from a blog.
- Draw the data path. For one application, draw every place data goes: user, your service, gateway, provider, logs, traces, vector store. Mark the region of each. Which one would surprise a customer? Hint: remember that logs and traces count.
- Write an exception. Pick a provider that is not on your list and write a complete exception request using the field table in 7.2, shrinking the risk as much as you can. Hint: a public-data, two-week pilot is easier to approve than a production launch.
- Build the conformance scan. Write a script that walks a repository, collects every string that looks like a model identifier in YAML or JSON files, and prints the ones not in your registry. Hint: start with a regular expression for your provider's naming pattern and expect false positives; refine the pattern.
Check yourself#
- Name the three layers of an approved-list standard and the question each one answers.Providers (who may receive prompts: contracts, security evidence, data handling), models (which specific models, for what purposes: capability, cost, lifecycle, licence), and regions and data classes (for which data and where each combination may run).
- Why is approving a provider not the same as approving a model?A trustworthy provider can serve a model that is unsuitable for a given use (preview status, no regional availability, near retirement, too costly), and each model has its own lifecycle and approved purposes.
- What is the difference between "no training" and "no retention"?"No training" is a promise not to use your data to improve models. "No retention" means the data is not stored. A provider can keep copies for abuse monitoring, safety or features without training on them.
- What does ZDR usually require, and why is "we have ZDR" an incomplete statement?ZDR is normally an account-level or contractual arrangement confirmed in writing, and it often excludes some endpoints or features. A complete statement names the endpoints covered.
- Give two reasons a SOC 2 report might not support approving a provider's API.The report may cover a different product (for example the chat app, not the API) or it may be out of date (the audit period ended long ago). Scope and period must both match.
- Explain the difference between data residency, processing location and access location.Residency is where stored data sits, processing location is where inference runs, and access location is where staff or subprocessors can reach the data. A provider can offer one without the others.
- Why is default deny safer than a denylist alone?A denylist only blocks what someone already thought of. New providers and models appear constantly, so unreviewed ones must be blocked by default.
- Name the four enforcement layers and one weakness of the first.Code review and CI, the shared client or wrapper, the gateway, and network and key controls. Code review and CI only checks what is in the repository.
- What should an exception request always include to be time-boxed and safe?What is wanted and why the list does not work, the data involved, risk and mitigations, a start and end date, an owner, an exit plan and an approver.
- In the Part 6 output, why is R5 an exception and not a denial?R5 is not a decision against the model; the model was never reviewed. The correct next step is to start the approval or exception process.
Further resources#
- Within this path: 02.9 Model Landscape (provider snapshot and privacy questions), 03.11 Provider-Agnostic Client, 11B.5 Model Selection and Routing, 11C.3 Fallbacks, Gateways and Reliability, 11C.6 Open-Weight and Local Models, 11C.2 CI/CD for Prompts and Evals, 12.4 PII, Privacy and Data Leakage, 12.7 Securing Data and the Supply Chain, 14A.9 Staying Current.
- Evaluation: 10A.2 Building Evaluation Datasets, 10A.3 Deterministic Metrics and Code Graders, 10A.7 Evaluating Agents and Multimodal, 10A.8 Regression Testing and CI, and the DeepEval track 10B.2 to 10B.7.
- Primary sources (check on the day): each provider's data-usage, retention and deprecation pages and trust portal; the standards bodies' pages for SOC 2 (AICPA) and ISO/IEC 27001 and 42001.
← Module 13B: Capstones | Module 14A overview | 14A.2 — Review Standards, Coding and Prompt Conventions →