Documentation Index Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
FailoverManager
Defined in the failover module.
Rust AI Agent SDK
Manages failover between multiple LLM auth profiles. Provides automatic failover when rate limits or errors occur, with configurable retry behavior and cooldown periods.
Fields
Name Type Description configFailoverConfigFailover configuration profilesVec<AuthProfile>Registered profiles current_indexusizeCurrent profile index callbacksVec<FailoverCallback>Failover callbacks
Methods
new
fn new ( config : FailoverConfig ) -> Self
Create a new failover manager.
Parameters:
Name Type configFailoverConfig
default_config
fn default_config () -> Self
Create with default config.
add_profile
fn add_profile ( &mut self , profile : AuthProfile ) -> ()
Add an auth profile.
Parameters:
Name Type profileAuthProfile
remove_profile
fn remove_profile ( &mut self , name : & str ) -> bool
Remove a profile by name.
Parameters:
get_profile
fn get_profile ( & self , name : & str ) -> Option < & AuthProfile >
Get a profile by name.
Parameters:
get_profile_mut
fn get_profile_mut ( &mut self , name : & str ) -> Option < &mut AuthProfile >
Get a mutable profile by name.
Parameters:
list_profiles
fn list_profiles ( & self ) -> & [ AuthProfile ]
List all profiles.
get_next_profile
fn get_next_profile ( &mut self ) -> Option < & AuthProfile >
Get the next available profile. Returns profiles in priority order, skipping those that are rate limited or in cooldown.
mark_failure
fn mark_failure ( &mut self , profile_name : & str , error : & str , is_rate_limit : bool ) -> ()
Mark a profile as failed.
Parameters:
Name Type profile_name&strerror&stris_rate_limitbool
mark_success
fn mark_success ( &mut self , profile_name : & str ) -> ()
Mark a profile as successful.
Parameters:
on_failover
fn on_failover ( &mut self , callback : FailoverCallback ) -> ()
Register a callback for failover events.
Parameters:
Name Type callbackFailoverCallback
get_retry_delay
fn get_retry_delay ( & self , attempt : u32 ) -> Duration
Calculate retry delay for an attempt.
Parameters:
status
fn status ( & self ) -> FailoverStatus
Get failover manager status.
reset_all
fn reset_all ( &mut self ) -> ()
Reset all profiles to available status.
len
Get the number of profiles.
is_empty
fn is_empty ( & self ) -> bool
Check if empty.
Source
View on GitHub praisonai/src/failover/mod.rs at line 292