Skip to content

Conversation

@mbutler-aws
Copy link

@mbutler-aws mbutler-aws commented Oct 9, 2025

Description

This PR implements FallbackModel, a new model wrapper that provides automatic failover between any two model instances with circuit breaker protection.

Related Issues

N/A

Documentation PR

strands-agents/docs#369

Type of Change

New feature

Testing

Yes. PR includes both unit tests (29) with 91% code coverage, and integration tests (7):

Unit Tests

  • Fallback triggering on throttle and connection errors
  • Circuit breaker behavior (opening, closing, cooldown)
  • Configuration and statistics tracking
  • Streaming and structured output with fallback
  • Error classification and re-raising

Integration Tests

  • Same-provider fallback (Bedrock→Bedrock)

  • Cross-provider fallback (OpenAI→Bedrock, Anthropic→Bedrock)

  • Agent integration with FallbackModel

  • Tool calling with real models

  • Statistics tracking with real API calls

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dnzprmksz
Copy link

Hey @mbutler-aws I was looking forward for this feature. Is it abandoned or will there be future work?

@mbutler-aws
Copy link
Author

Added supporting documentation PR (strands-agents/docs#369). Unit tests and integration tests passed locally. Ready for review.

@mbutler-aws
Copy link
Author

Hey @mbutler-aws I was looking forward for this feature. Is it abandoned or will there be future work?

Thanks for the nudge @dnzprmksz. Created the documentation PR today for the functionality. Hopefully can get this PR integrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants