A retry policy separates transient failure from a request that needs correction. Count the first attempt inside the cap and stop immediately on a permanent error. The local client returns scripted errors, so you can test recovery without waiting or sending another provider request.
Call a fresh client using case.script. Retry only mock statuses 429 and 503, up to case.max_attempts total calls. Return status ok and attempts on success; otherwise return status stopped, attempts and the final status code. A permanent 400 stops immediately.
The notebook executes your Python against an original local mock. Use the supplied case rather than copying visible values. The hidden checks change identities, revisions and boundary inputs; no provider endpoint or external tool is contacted.
An example implementation of the function contract.