Learn how to create AI agents that can dynamically route tasks to specialized LLM instances.
Install Package
Set API Key
Create a file
app.py
with the basic setup:Start Agents
praisonaiagents.agent.router_agent
, not directly from praisonaiagents
.Parameter | Type | Description | Default |
---|---|---|---|
models | List[str] or Dict | List of model names or model configuration | None |
model_router | ModelRouter | Custom ModelRouter instance | None |
routing_strategy | str | Strategy: “auto”, “manual”, “cost-optimized”, “performance-optimized" | "auto” |
primary_model | str | Primary model to use | None |
fallback_model | str | Fallback model for errors | None |
**kwargs | Any | Standard Agent parameters (name, role, goal, etc.) | - |
execute()
or start()
methods, not chat()
get_usage_report()
, not last_model_used