# Retry (/examples/models/cohere/retry)



<Warning>
  The preserved source imports `CohereChat`, which is no longer exported. Use `Cohere` in new code. The current adapter also omits HTTP status codes when wrapping SDK errors, so Agno's retry filter cannot distinguish terminal 400/404 responses on this path. An invalid model ID is unsuitable for testing recovery.
</Warning>

```python title="retry.py"
"""Example demonstrating how to set up retries with Cohere."""

from agno.agent import Agent
from agno.models.cohere import CohereChat

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

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

agent = Agent(
    model=CohereChat(
        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 [#current-alternative]

Use the current class and a valid model:

```python
from agno.agent import Agent
from agno.models.cohere import Cohere

agent = Agent(
    model=Cohere(
        id="command-a-03-2025",
        retries=2,
        delay_between_retries=1,
        exponential_backoff=True,
    )
)
agent.print_response("What is the capital of France?")
```

Install `agno cohere` and export `CO_API_KEY` as shown in the [basic example](/examples/models/cohere/basic). These settings control Agno retries in addition to any SDK retry policy. Exercise recovery with a controlled transient failure and a valid model ID. With the current adapter, configuring retries can also repeat terminal failures.

Full source: [cookbook/90\_models/cohere/retry.py](https://github.com/agno-agi/agno/blob/8f36eaf2d18e91afa7b327eec66a3cd3685dcb87/cookbook/90_models/cohere/retry.py)
