Retry

Review Bedrock retry settings and the current adapter limitation when classifying AWS errors.

On this revision, AwsBedrock drops the HTTP status when wrapping AWS ClientError responses. Ordinary 400 validation and 404 not-found errors can therefore be retried, even though Agno's status-aware policy treats those statuses as terminal. The source's invalid-ID request can exercise this adapter limitation; use controlled transient failures to test the intended retry behavior.

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

from agno.agent import Agent
from agno.models.aws import AwsBedrock

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

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

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

Configure retries, delay_between_retries, and exponential_backoff as shown in Retry Model Requests. Test the retry path with a controlled transient 429, connection failure, or 5xx response.

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