Before You Switch Models, Write the Exit Test.
API compatibility can move the request. Only an application contract can preserve the promise.
Read the full white paper PDF · 14 pages ↓A replaceable endpoint is not a portable workflow. Write the application promise, test its boundaries, and retain the evidence needed to change providers responsibly.
The endpoint changes. The obligation stays.
An AI provider can be easy to replace in code and difficult to leave in practice. Change the endpoint and credentials, receive a fluent answer, and the migration looks finished. The application still has to interpret what came back. That is where an apparently compatible replacement can change the product.
Imagine a support workflow that treats any returned string as a completed answer. A refusal, an interrupted response and a request to call a tool each need different handling. Flatten them into text and the application loses the distinction. This is an illustrative workflow, not a reported incident. The failure is in the interpretation contract, even when both providers behave as documented.
API compatibility establishes that software can exchange messages. Behavioral portability requires evidence that the replacement preserves what the product promises users. Write that promise before choosing the replacement. Otherwise the exit test can become a description of whatever the new model happens to do.
Our contribution is a small, reproducible adapter test and a broader migration framework. No live provider was tested. The example measures local interpretation of authored fixtures, not model quality, reliability or cost.
A response is more than an answer
The captured OpenAI Responses type distinguishes generation states including completed, failed, queued and incomplete. Its output messages can contain text or refusal content. The convenience property output_text returns an empty string when there are no text blocks; that emptiness does not explain why. [1]
The captured function-call type carries a name, call identifier and arguments as a JSON string. Anthropic's captured tool-use type carries a name, identifier and input dictionary, while its message stop reason distinguishes natural completion, tool use, output limits, pauses and refusal. [2][3]
Neither interface is wrong. An adapter has to preserve the distinctions the application needs. A proposed tool call is not a completed task. A refusal is not merely missing text. A nonterminal response should not become success because its first sentence sounds complete.
Even the Agents SDK's multi-provider guidance warns about feature differences and additional adapter layers. Its model interface includes conversation state, output schemas, tools and tracing options. A provider change can reach well beyond a prompt and a string. [5][6]
The adapter carries a promise, not just a field.
Three boundaries separate a successful exchange from a successful replacement. Preserve the distinctions before evaluating the answer.
Envelope
Inspect generation status, stop reason and content type. Text extraction alone loses refusal and interruption.
Workflow outcome
Preserve answer, tool proposal, refusal, incomplete and unknown outcomes. Keep call identity and validated arguments.
Product promise
Evaluate task meaning, permitted data movement, operational limits and recovery. Shape compatibility does not answer these.
Analytical framework grounded in inspected interface distinctions. It is not a model comparison or a claim of feature parity.
Write the application contract first
For our example, the product owns five outcomes: answer, proposed ticket lookup, refusal, incomplete response and blocked response requiring investigation. It permits exactly one text outcome or one tool proposal. It intentionally blocks richer content it does not understand.
A real contract should describe the product's work. A drafting assistant can accept different phrasing while requiring accurate facts. A router can accept different explanations while requiring a justified destination. An action-taking assistant needs authorization after a model proposes the action. Normalizing a tool request does not grant that authority.
Separate hard gates from preferences. Preserving refusal and unknown states may be mandatory. A latency increase may be negotiable if quality improves. A new data destination may require separate permission. Combining everything into one migration score would hide these different decisions.
Do not use the incumbent's output as an unquestioned answer key. That rewards copying its mistakes. Compare both systems with the underlying task requirement, allowing the variation that requirement permits. Retain disagreements rather than making ambiguous cases disappear from the denominator.
Fourteen fixtures expose the missing decisions
Our downloadable Python example uses only the standard library. It creates fourteen pairs of reduced, hand-authored response envelopes resembling the documented field shapes. They are not captured provider outputs. [8]
Two cases describe permitted behavior: a text answer and one lookup_ticket proposal. Twelve test boundaries: refusal, output limits, unknown state or content, malformed arguments, a disallowed tool, missing call identifier, wrong argument type, extra argument, empty text, multiple tools and a nonterminal response.
An intentionally incomplete adapter merely renames fields and returns the first block. It preserves two of the fourteen expected outcomes. The old and new contract-aware adapters each preserve all fourteen. Three adapters across fourteen cases produce forty-two local evaluations, with assertions checking expected outcomes and agreement between the contract-aware implementations.
The shortcut is deliberately deficient code written for this illustration, not a vendor implementation. Its twelve mismatches comprise five tool-contract cases, three unknown or nonterminal cases, and one each for refusal, interruption, empty content and multiple outcomes. Those frequencies reflect our authored set. They say nothing about production incidence.
Run python3 example.py to reproduce the observations and write results.json. The file includes every expected and actual result, source and fixture hashes, and limitations. No SDK, API key, network access or tool execution is involved. Passing means preserving this small interpretation contract; it does not certify a provider or a live workflow.
Fourteen fixtures. Twelve decisions the shortcut lost.
Each adapter interpreted the same fourteen authored cases. The deliberately incomplete shortcut drops stop-state and validation decisions.
Old contract adapter
Preserved every expected local outcome across permitted behavior and failure boundaries.
New field shortcut
Preserved only the two permitted cases. Twelve boundary outcomes mismatched.
New contract adapter
Preserved the same application outcomes with a different reduced response envelope.
42 adapter-case evaluations; 0 external model calls; 0 tool executions. Five tool-contract failures, three unknown/nonterminal failures, and four other mismatches in the shortcut. Authored fixture frequencies are not production rates.
Valid JSON does not establish truth
A perfectly shaped lookup can name the wrong ticket. A valid answer object can invent its contents. Structural validation and semantic evaluation answer different questions.
The inspected JSON Schema Test Suite explicitly tests specification conformance. Its cases distinguish types, required properties and additional fields. They do not determine whether a claim is true. [4] Our example is not a JSON Schema implementation: it checks one dictionary containing exactly one nonempty string field.
For a production schema, use an appropriate validator and declare its dialect. For meaning, select representative tasks before examining candidate outputs and define why an answer is acceptable. Exact matching suits some fields; expert judgment suits others. Keep uncertainty visible, and test important failure classes even when they are rare. A deliberately difficult sample can expose failures without estimating their everyday frequency.
Your conversation may not travel with you
The inspected model interface carries previous-response and conversation identifiers. The captured Responses documentation also says instructions from a previous response do not automatically carry forward when using previous_response_id. [1][6] A visible transcript is therefore not necessarily the whole application state.
Inventory instructions, retrieved material, tool definitions, permissions and results. Distinguish application-owned state from provider-held state. Decide what can be exported, reconstructed from an authorized source, discarded or used while an existing run finishes. A newly generated summary is a new interpretation, not the original context restored.
Check tracing destinations too. The captured Agents interface separates tracing with data, tracing without input/output data and disabled tracing. [6] Those settings do not establish compliance by themselves. Shadow evaluation sends data to another destination, even if users never see its answers. This paper did not audit account terms, retention policies or transfer permissions.
Measure the workflow, then rehearse rollback
A token price is only one component of migration economics. A completed workflow may include retries, tools, retrieval, review and failed attempts. The captured OpenAI SDK documents configurable timeouts and automatic retries for specified errors. Anthropic's message documentation explains that usage does not map one-to-one to visible content. [3][7] Neither observation establishes which provider is cheaper.
Measure request-to-usable-result time, with first visible output reported separately where useful. Keep the task sample, observation window and tail behavior attached. Reconcile usage with applicable billing evidence, and mark missing information as missing. The local fixtures measure none of these operational quantities.
Build a release packet connecting application revision, adapter revision, model configuration, fixture results and task evaluation. Where the consequences warrant it, use a bounded rollout with explicit stop conditions. A successful offline test is a first gate, not permission to route every workflow immediately.
Rehearse rollback separately. Redirecting new requests does not make active conversation state portable. Existing runs may need to finish on their original route, restart from an application-owned checkpoint or pause for human recovery. The fallback could be a manual queue or reduced service. It should preserve a stated promise rather than simulate continuity it cannot provide.
A release has gates. An exit needs a return path.
Move from a local contract to a bounded routing decision. Each gate answers a different question; no single score replaces the others.
Interpret
Pass known shape, refusal, tool and unknown-state cases. Record the exact adapter and application revisions.
Evaluate
Judge authorized representative tasks against requirements. Confirm context and trace destinations are permitted.
Observe
Measure usable-result latency, complete-workflow cost and important failure classes in a declared window.
Recover
Specify stop conditions and what happens to in-flight state. Rehearse a checkpoint, reduced service or human queue.
The fixture exercise implements only the first gate. No live canary, quality study, billing comparison, policy audit or production rollback was performed.
Independence without a lowest common denominator
Provider-specific capabilities can justify their replacement cost. An exit contract should expose that tradeoff, not prohibit it. Record the benefit, dependency and fallback. Nor must a small team maintain two live integrations indefinitely: an application-owned task corpus and a documented stopping point can be a sensible starting investment.
The evidence should match the consequence of error. Fourteen illustrative fixtures cannot certify an assistant that changes external records. They can show a builder where field compatibility stops answering the question.
We captured pinned official SDK and test-suite sources on November 16, 2026. Source versions identify the inspected code, not a frozen model or a future availability promise. The full paper develops the data, evaluation, economic and recovery boundaries, with the reproducible example linked in the references.
Pick one workflow. Name its acceptable outcomes and one unacceptable confusion. Turn that confusion into a test before choosing the replacement. The endpoint is replaceable. The responsibility to preserve what the product means is yours.
Questions worth asking.
Does an OpenAI-compatible API make two models interchangeable?
It can simplify how requests are sent, but it does not establish that a replacement preserves task quality, tool semantics, stop states, context or operational limits. The inspected Agents SDK documentation explicitly warns about feature differences and added adapter layers. Evaluate the exact provider path and the application behavior you intend to preserve. [5]
Should every result match the incumbent model word for word?
No. Define acceptance from the underlying task, not from the incumbent’s output. A summary may vary in phrasing while preserving all material facts; a tool proposal may need an exact allowed name and validated fields. Treat refusal, incomplete output and unknown states distinctly. An exit test should recognize genuine improvements rather than reward copying existing mistakes.
What does the fourteen-case fixture result prove?
It shows that two local adapters preserve the fourteen expected outcomes in an authored set, while a deliberately incomplete shortcut preserves two. The envelopes are reduced illustrations, not captured provider responses. The result does not measure model quality, production failure frequency, streaming, cost, latency or the safety of executing tools. The Python source and detailed results are downloadable in reference 8. [8]
Should a small team run two providers all the time to avoid lock-in?
Not necessarily. Maintaining a second live integration has a cost. A bounded application-owned task corpus, explicit state inventory and documented fallback may be the proportionate starting point. Provider-specific features can justify dependence when their benefit, replacement cost and failure mode are consciously accepted. The framework does not require a lowest-common-denominator product.
Can rollback simply switch the model setting back?
That may redirect new requests, but it does not establish that an active workflow’s conversation state is portable. Depending on the task, existing runs may need to finish on their original route, restart from an application-owned checkpoint or pause for human recovery. Rehearse that decision and prevent duplicate effects. A reduced service or manual queue can be a more honest fallback than pretending continuity is preserved.
Sources & method.
Analysis of pinned official OpenAI Python, Anthropic Python, OpenAI Agents SDK and JSON Schema Test Suite repository sources captured November 16, 2026. The original local example ran fourteen hand-authored fixture pairs across three adapters: forty-two evaluations, zero external model calls and zero tool executions. Counts concern authored interpretation cases, not provider incidence or model performance. The migration framework is a proposal; live quality, latency, cost, account policies, streaming and production rollback were not evaluated.
- Responses object, generation states and text/refusal output types OpenAI · Repository snapshot captured 2026-11-16 · Primary SDK interface source
Inspected response.py, response_status.py, response_output_message.py and response_output_refusal.py. Source version declares 3.51.0. Supports output array, distinct generation states, text/refusal blocks, empty-string behavior of output_text and prior-response instruction handling. Does not establish model accuracy, server availability or reproducibility.
- Responses function-call representation OpenAI · Repository snapshot captured 2026-11-16 · Primary SDK tool interface source
Arguments are represented as a JSON string; name and call_id are separate fields. The fixture borrows this reduced shape but is not captured provider traffic or a complete adapter implementation.
- Messages response, stop reasons and tool-use representation Anthropic · Repository snapshot captured 2026-11-16 · Primary SDK interface source
Inspected message.py, stop_reason.py, tool_use_block.py and model.py. Source version declares 2.8.0. Distinct stop reasons, tool input dictionary, identifiers and usage/visible-content distinction support the analysis. No current pricing, model ranking or service guarantee inferred.
- JSON Schema validation test suite JSON Schema organization · Repository snapshot captured 2026-11-16 · Primary conformance-test documentation and fixtures
Inspected README plus validation/tests/type.json, required.json and additionalProperties.json. The suite tests specified schema behavior, including numeric-looking strings, booleans, required fields and extra properties. We did not run or claim conformance to this suite; our program validates one explicitly limited application contract.
- Models: provider integration and feature differences OpenAI Agents SDK contributors · Repository snapshot captured 2026-11-16 · Primary integration documentation
Inspected provider integration, mixing model shapes, structured-output and third-party adapter sections. Documents feature differences and added adapter compatibility layers. Normative integration guidance, not independent failure-frequency measurements. The source version fallback is 0.24.0; no SDK package was installed.
- Model interface and tracing distinctions OpenAI Agents SDK contributors · Repository snapshot captured 2026-11-16 · Primary model interface source
Inspected model parameters, previous_response_id/conversation_id distinctions, tool call correlation and ModelTracing states. Tracing options are configuration capabilities, not a privacy-compliance determination or evidence of actual account settings.
- OpenAI Python SDK: request IDs, retries, timeouts and versioning OpenAI · Repository snapshot captured 2026-11-16 · Primary SDK operational documentation
Inspected request tracing, configured retries, timeouts and versioning sections. Describes SDK behavior at this revision; it is not an SLA, price sheet or observed latency measurement. Source version file also captured.
- Model-exit fixture example and reproducible local results Kymata Labs Research · 2026-11-16 · Original illustrative executable artifact
Run python3 example.py with Python 3.10 or later; standard library only. Fourteen paired fixtures, three adapters, forty-two evaluations. Old contract and new contract each preserve 14/14 expected outcomes; deliberately incomplete shortcut preserves 2/14. No external model calls or tool executions. Results: https://www.kymatalabs.com/research/before-you-switch-models-write-the-exit-test/assets/results.json. Fixture incidence is authored and cannot estimate provider failure rates.
The full argument.
Yours to keep.
The developed analysis, evidence, counterarguments and practical framework, in one carefully designed white paper.
14 pages · 3 figures · 8 references · PDFDownload the white paper Free to read. No signup.