Govern every decision, inside the agent

cascadeflow is the open-source AI agent runtime layer that sees every step your agent takes and steers each model call, tool call, and handoff toward your policies and goals.

$ pip install cascadeflow$ npm install @cascadeflow/core

MIT open source · sub-5ms overhead · full per-step audit trail

bash · cascadeflow
$ pip install cascadeflow
$ python run_agent.py
[cascadeflow] analyzing step… predicted cost > threshold, quality > min
[cascadeflow] ACTION: switch_model(cost-optimized)
[cascadeflow] sub-agent call optimized and routed
✓ agent run complete · final cost 0.0001 · 92% reduction
IBM watsonx
JetBrains
PwC
True Ventures
Alumni Ventures

Runs in-process

cascadeflow sits inside the AI agent.

An open-source AI agent runtime layer that observes, scores, and enforces every step of agent execution. It is framework-neutral and runs in minutes.

import cascadeflow
cascadeflow.init(mode="observe")
# every model call now tracked with zero code changes

Agent frameworks

LangChain · OpenAI Agents SDK · CrewAI · PydanticAI · Google ADK · Vercel AI · n8n · OpenClaw · Hermes Agent

cascadeflow runtime

Observe · Score · Enforce

In-process · sub-5ms overhead · full audit trail

Models & tools

OpenAI · Anthropic · Groq · Together · on-prem vLLM · Ollama · 17+ providers

Enforce policy at every agent step

cascadeflow injects your policies and KPIs directly into the agent and steers execution in real time. It scores every step across cost, latency, quality, budget, compliance, and energy, plus any custom dimensions you define in Studio. Eight runtime actions enforce the result.

// 6 built-in dimensions + custom · 8 enforcement actions

allow

Let the step proceed when cost and quality are within policy.

switch_model

Escalate or downshift by routing from a flagship model to a cheaper one during the run.

deny_tool

Block expensive or non-compliant tool calls before they execute.

stop

Terminate execution on a safety, budget, or compliance rule.

retry
require_approval
redact
serve_from_cache

// Domain-aware intelligence

Route every step to the right specialist

cascadeflow detects the domain of each query and routes every agent step to the model cascade built for that work. Small, domain-specialized models routinely outperform large general-purpose models on specialized tasks, so you get better answers and lower cost at the same time.

$domain:code

"Fix this Python race condition"

→ code-tuned drafter, escalate to flagship on failed tests

$domain:writing

"Draft the launch announcement"

→ writing-optimized model, higher quality bar

$domain:data

"Summarize this CSV of orders"

→ fast, low-cost model · speed prioritized

$domain:legal

"Review this indemnity clause"

→ high-accuracy verifier, strict compliance scoring

$domain:support

"Why was my invoice declined?"

→ cheap drafter first, escalate only when unsure

$domain:general

"Anything else"

→ free-first cascade, escalate on quality miss

Inside the agent, not a proxy

Proxies see requests. cascadeflow sees decisions.

Routers and gateways sit at the HTTP boundary. They see the request but miss the decisions inside agent execution. cascadeflow runs in-process where cost, risk, and failure actually occur.

External proxy / router
cascadeflow
Vantage point
Request boundaries only
Every model call, tool call, and handoff
Latency
+40-60ms per call, or 400-600ms across a 10-step run
Sub-5ms, in-process
Control
Route once, up front
Stop, escalate, deny, or switch mid-run
Learning
Static rules
Every run compounds routing intelligence

Three lines of code. Works with your stack.

No rip-and-replace. cascadeflow drops into your existing agent framework and model providers, then optimizes every run.

agent.py
import cascadeflow

@cascadeflow.govern()
async def run_agent(task):
    # your agent runs as usual while cascadeflow optimizes each step
    return await agent.run(task)

Frameworks

LangChainLangGraphVercel AI SDKOpenAI Agents SDKCrewAIn8nOpenClawHermes Agent

OpenAI · Anthropic · Groq · Ollama · vLLM · Together AI · HuggingFace + 100 more via LiteLLM

69%cost savings (MT-Bench)
93%cost savings (GSM8K)
96%of GPT-5 quality retained
<5msruntime overhead

cascadeflow Studio

Fleet-wide visibility and governance

Business intelligence for AI agents, plus two dedicated visual builders, one for policies and one for domains, so you can govern KPIs, cost routing, and compliance across your entire agent fleet.

Dedicated builder

Policy Builder

Define custom scoring dimensions, KPI weights, and governance policies beyond the six built-in dimensions. Enforce them across every agent with gradual rollouts and automatic rollback.

Dedicated builder

Domain Builder

Map each domain to its specialist model cascade and tune keyword and semantic routing visually without code. Version domains and enforce them fleet-wide.

cascadeflow Studio dashboard showing agent fleet overview, KPI thresholds, cost breakdown, and ROI analytics

Self-learning agent intelligence

Every run feeds patterns back to Studio through auto-benchmarks, model fleet suggestions, compounding optimization.

Fleet BI & ROI analytics

Real-time cost breakdowns by provider, model, domain, and user. Spending forecasts and exportable reports.

KPI enforcement & governance

Turn business KPIs into live guardrails for cost routing, compliance rules, and quality bars at every step.

Organization controls

Role-based access, SSO/SAML, audit logs, and multi-org workspaces. Integrates with Slack, Datadog, and your finance stack.

See Studio governance running across your agent fleet.

// FAQ

Frequently asked questions

What is cascadeflow?+

cascadeflow is an agent runtime intelligence layer inside AI agent execution. It sees model calls, tool calls, and sub-agent handoffs, then steers each decision toward your policies and goals. Every step is scored across cost, latency, quality, budget, compliance, and energy in real time.

How is cascadeflow different from a model router or proxy?+

Proxies and model routers see requests going in and out from outside the agent. cascadeflow runs inside agent execution, where it can switch models during a run, deny a tool call, require approval, redact, retry, serve from cache, or stop execution. This gives cascadeflow direct control over the decisions that create cost and risk.

How much can cascadeflow reduce AI costs?+

cascadeflow reduces agent inference cost by up to 90% while retaining roughly 96% of GPT-5 quality, with sub-5ms overhead per decision. Intelligent model cascading and domain-aware routing classify each query and send it through a specialist model cascade rather than always calling a large general model.

Is cascadeflow open source?+

Yes. The cascadeflow core is open source under the MIT license and scores every step across six built-in dimensions with eight runtime enforcement actions. cascadeflow Studio is the full managed, self-optimizing version that adds visual Policy and Domain builders and lets you define custom policies and scoring dimensions beyond the six built-in ones.

What is cascadeflow Studio?+

cascadeflow Studio is the full managed version of cascadeflow. Its UI and CLI help teams run, set up, optimize, and adjust governed agents. The Policy Builder and Domain Builder define, version, and enforce custom policies, KPIs, and domain cascades without hand-written enforcement code.

What can cascadeflow enforce at runtime?+

Every agent step is scored across six built-in dimensions: cost, latency, quality, budget, compliance, and energy. Studio can add custom dimensions. cascadeflow acts on the result with eight enforcement actions: allow, switch_model, deny_tool, stop, retry, require_approval, redact, and serve_from_cache.

3,219GitHub stars
30K+downloads
671forks

Start governing every agent decision

Open source, MIT licensed, three lines of code. See and steer every agent step while cutting inference cost by up to 90%.

$ pip install cascadeflowGet started
or star us on GitHub →