Skip to main content

FailoverManager

Defined in the failover module.
AI Agent Manages failover between multiple LLM auth profiles. Provides automatic failover when rate limits or errors occur, with configurable retry behavior and cooldown periods.

Constructor

config
Optional
No description available.

Methods

Usage

manager = FailoverManager()
    manager.add_profile(AuthProfile(
        name="openai-primary",
        provider="openai",
        api_key="sk-...",
        priority=0,
    ))
    manager.add_profile(AuthProfile(
        name="openai-backup",
        provider="openai",
        api_key="sk-...",
        priority=1,
    ))
    
    # Get next available profile
    profile = manager.get_next_profile()
    
    # On failure
    manager.mark_failure(profile, "Rate limit exceeded")
    
    # Get next profile (will return backup)
    profile = manager.get_next_profile()

Source

View on GitHub

praisonaiagents/llm/failover.py at line 199