Skip to main content

Presets

Create a CascadeAgent with a single function call using preset profiles that configure models, quality thresholds, and routing strategies.

Preset Functions

from cascadeflow.utils.presets import (
    get_cost_optimized_agent,
    get_balanced_agent,
    get_speed_optimized_agent,
    get_quality_optimized_agent,
    get_development_agent,
    auto_agent,
)

Cost Optimized

Maximizes savings by using the cheapest models first with aggressive cascading.
agent = get_cost_optimized_agent(verbose=True)

Balanced

Default tradeoff between cost, quality, and speed.
agent = get_balanced_agent()

Speed Optimized

Prioritizes low latency — prefers fast models and direct routing.
agent = get_speed_optimized_agent()

Quality Optimized

Prioritizes response quality — higher thresholds, more willing to escalate to verifier.
agent = get_quality_optimized_agent()

Development

Uses free/local models for development and testing.
agent = get_development_agent(verbose=True)

Auto Agent

Create from a profile name string.
agent = auto_agent("cost_optimized")
agent = auto_agent("balanced")
agent = auto_agent("speed_optimized")
agent = auto_agent("quality_optimized")
agent = auto_agent("development")

From Profile

CascadeAgent.from_profile() is the class method equivalent:
from cascadeflow import CascadeAgent

agent = CascadeAgent.from_profile("balanced", verbose=True)

From Environment

Auto-detect available providers from environment variables:
agent = CascadeAgent.from_env(verbose=True)
# Detects OPENAI_API_KEY, ANTHROPIC_API_KEY, GROQ_API_KEY, etc.