Skip to main content

Module retry

Module retry 

Source
Expand description

Transient-error retry wrapper around a CompletionModel.

RetryingModel wraps the OpenAi-backed completion model so that each individual model call retries on transient HTTP failures (request timeouts, connection errors, 408/425/429/5xx) with bounded exponential backoff.

Retrying at the model-call layer – rather than around agent.prompt(...) – is deliberate: a single user turn drives a model -> tool -> model loop, and wrapping the whole prompt would re-execute already-run container tool calls when a later model call fails. A failed model call has produced no tool calls yet, so retrying just that call replays nothing observable.

Structs§

RetryingModel
Wraps a CompletionModel, retrying transient failures on every call.