# How to Test AI Provider Timeouts Before Production

> Source: <https://dev.to/tek_uae_0be01409d814110ee/how-to-test-ai-provider-timeouts-before-production-dc6>
> Published: 2026-11-27 10:12:30+00:00

**Recommendation:** Test timeout, 429, malformed-response and duplicate-job cases against a stub provider before production, and key side-effecting work on a stable job ID so retries never produce a second result.
More in the playbook "Running AI in production": <https://wpnews.pro/playbooks/production-ops>

*Disclosure: This article was drafted with AI assistance.*

When an application depends on an AI provider, write down what your app should do when the provider times out before you wire up retries. Otherwise, a slow request can tie up a worker and a retry can accidentally start the same job twice.

Start with the time a user can reasonably wait for the feature. If a page has a five-second budget, the model call needs a shorter deadline so the app has time to return a useful response. If the work routinely takes longer, give the user a job ID and show its status instead of holding the page open.

Use a stub provider in your test environment. Make it return the same outcomes your integration handles in production:

| Stub response | What to check | 
|---|---|
| Delayed response | The app reaches its deadline and returns the intended fallback. | 
| HTTP 429 | Retries stay within the deadline and respect the provider’s retry guidance. | 
| Malformed response | Validation fails and the app does not store a partial result. | 
| Duplicate job ID | The same job does not produce a second user-visible result. | 

For operations with side effects, carry a stable job ID through the queue and persistence layer. Test that processing the same job twice leaves a single result. Keep request IDs and timing in the logs so you can trace failures without storing the full prompt.

For related reading on cloud infrastructure and AI, see my [GlobalDXB technology blog](https://www.globaldxb.com/).
