Retry

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

The current native Cerebras adapter lets SDK exceptions escape without converting them into Agno model errors, so the source’s retries, delay_between_retries and exponential_backoff settings do not control those failures. An invalid model ID also cannot become valid through retrying.

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

from agno.agent import Agent
from agno.models.cerebras import Cerebras

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

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

agent = Agent(
    model=Cerebras(
        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 the native SDK retry option with a valid model:

from agno.agent import Agent
from agno.models.cerebras import Cerebras

agent = Agent(model=Cerebras(id="gpt-oss-120b", max_retries=2))
agent.print_response("What is the capital of France?")

Install agno cerebras-cloud-sdk and export CEREBRAS_API_KEY as shown in the basic example. max_retries controls the SDK's retry policy; it does not use Agno’s delay/backoff settings. Test it with a controlled transient response and a valid ID. Use CerebrasOpenAI when you need the OpenAI-compatible adapter and its Agno error handling.

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