Open
Description
Describe the question
I would like to implement an Agent with a custom and strong retry mechanism with fallback to another llm model if something goes wrong.
LiteLLM implements a router to do that: https://docs.litellm.ai/docs/routing
However I cannot pass a Router instance to the model params of the Agent.
You Documentation says the we need to set the model to an instance of LitellmModel, but there is no way to specify a fallback strategy.
Is there a way to do that?
Debug information
- Agents SDK version: 0.0.17
- Python version: 3.12
Repro steps
from litellm.router import Router
router = Router(
model_list=[
{
"model_name": "gemini-1.5-flash",
"litellm_params": {"model": "gemini/gemini-1.5-flash"},
"timeout": 120,
"retries": 1,
},
{
"model_name": "gemini-1.5-pro-latest",
"litellm_params": {"model": "gemini/gemini-1.5-flash"},
"timeout": 80,
},
],
fallbacks=[{"gemini-1.5-flash": ["gemini-1.5-pro-latest"]}],
)
agent = Agent(
name="My Agent",
instructions=",
model=router, # cannot do that
)
Expected behavior
Have the possibility to pass a LiteLLM router or specify a fallback strategy for an Agent