Retry

Review retry settings and why invalid model IDs cannot reliably exercise the retry path.

At the linked revision, MistralChat wraps SDK errors without preserving their HTTP status. Agno can therefore retry terminal 400/404 errors as well as transient failures. An invalid model ID is not a useful retry test.

retry.py
"""Example demonstrating how to set up retries with Mistral."""

from agno.agent import Agent
from agno.models.mistral import MistralChat

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

# We will use a deliberately wrong model ID, to trigger retries.
wrong_model_id = "mistral-wrong-id"

agent = Agent(
    model=MistralChat(
        id=wrong_model_id,
        retries=3,  # Number of times to retry the request.
        delay_between_retries=1,  # Delay between retries in seconds.
        exponential_backoff=True,  # If True, the delay between retries is doubled each time.
    ),
)

agent.print_response("What is the capital of France?")

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass

Current Alternative

Use a valid model such as MistralChat(id="mistral-small-latest", retries=3, delay_between_retries=1, exponential_backoff=True) with the basic example's setup. Exercise retries with controlled transient failures.

These are Agno retry settings. The Mistral SDK has a separate retry_config; its retries can add attempts. Do not pass OpenAI's max_retries option through MistralChat.client_params to the Mistral SDK.

Full source: cookbook/90_models/mistral/retry.py