Skip to main content

Posts

Showing posts from November, 2026

Pydantic AI Sticky Fallback Explained: Let the Backup Start the Next Turn

A backup model is less useful if every new message first waits for the same broken primary. I would use sticky fallback to remember a working route within a conversation, while keeping that routing choice separate from service health and permission to execute tools. This guide explains Pydantic AI’s ModelFallback(..., sticky=True) through a small support-chat example. We will follow the history that carries the choice, test what happens when the backup fails, identify the streaming boundary, and budget nested retries without assuming a cache hit or an immediate failover.