> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Failover Manager • AI Agent SDK

> FailoverManager: Manages failover between multiple LLM auth profiles.

# FailoverManager

> Defined in the [**failover**](../modules/failover) module.

<Badge color="blue">AI Agent</Badge>

Manages failover between multiple LLM auth profiles.

Provides automatic failover when rate limits or errors occur,
with configurable retry behavior and cooldown periods.

## Constructor

<ParamField query="config" type="Optional" required={false}>
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="add_profile()" icon="function" href="../functions/FailoverManager-add_profile">
    Add an auth profile.
  </Card>

  <Card title="remove_profile()" icon="function" href="../functions/FailoverManager-remove_profile">
    Remove a profile by name.
  </Card>

  <Card title="get_profile()" icon="function" href="../functions/FailoverManager-get_profile">
    Get a profile by name.
  </Card>

  <Card title="list_profiles()" icon="function" href="../functions/FailoverManager-list_profiles">
    List all profiles.
  </Card>

  <Card title="get_next_profile()" icon="function" href="../functions/FailoverManager-get_next_profile">
    Get the next available profile.
  </Card>

  <Card title="mark_failure()" icon="function" href="../functions/FailoverManager-mark_failure">
    Mark a profile as failed.
  </Card>

  <Card title="mark_success()" icon="function" href="../functions/FailoverManager-mark_success">
    Mark a profile as successful.
  </Card>

  <Card title="on_failover()" icon="function" href="../functions/FailoverManager-on_failover">
    Register a callback for failover events.
  </Card>

  <Card title="get_retry_delay()" icon="function" href="../functions/FailoverManager-get_retry_delay">
    Calculate retry delay for an attempt.
  </Card>

  <Card title="status()" icon="function" href="../functions/FailoverManager-status">
    Get failover manager status.
  </Card>

  <Card title="reset_all()" icon="function" href="../functions/FailoverManager-reset_all">
    Reset all profiles to available status.
  </Card>
</CardGroup>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/llm/failover.py#L199">
  `praisonaiagents/llm/failover.py` at line 199
</Card>
