> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Retry

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

> [!WARNING]
>
> This example assumes an invalid model ID triggers the configured retries. Invalid-model responses commonly use terminal 400 or 404 statuses, which Agno does not retry. Do not run this source as a retry test.

```python retry.py theme={null}
"""Example demonstrating how to set up retries with Nexus."""

from agno.agent import Agent
from agno.models.nexus import Nexus

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

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

agent = Agent(
    model=Nexus(
        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

[Install Nexus](https://nexusrouter.com/docs/installation), then create `nexus.toml` for the Anthropic model and the `/llm/v1/` endpoint used by Agno:

```bash theme={null}
cat > nexus.toml <<'TOML'
[server]
listen_address = "127.0.0.1:8000"

[llm]
enabled = true

[llm.protocols.openai]
enabled = true
path = "/llm"

[llm.providers.anthropic]
type = "anthropic"
api_key = "{{ env.ANTHROPIC_API_KEY }}"

[llm.providers.anthropic.models."claude-sonnet-4-6"]
TOML
nexus
```

Configure `retries`, `delay_between_retries`, and `exponential_backoff` as shown in [Retry Model Requests](https://agno-v2.mintlify.site/models/overview.md#retry-model-requests). Test the retry path with a controlled transient 429, connection failure, or 5xx response.

Full source: [cookbook/90\_models/nexus/retry.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/nexus/retry.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.