Govern every decision, inside the agent

cascadeflow is the open-source runtime layer that sees every step your agent takes — then 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 agent.

An open-source runtime layer that observes, scores, and enforces on every step of agent execution — framework-neutral, running in minutes.

import cascadeflow
cascadeflow.init(mode="observe")
# every model call now tracked — 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. Every step is scored — cost, latency, quality, budget, compliance, and energy out of the box, plus any custom dimensions you define in Studio — then acted on with eight runtime enforcement actions.

// 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 — route from a flagship model to a cheaper one mid-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 over reasoning

$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, not the decisions between them. cascadeflow runs in-process, right where the agent makes its decisions, where cost, risk, and failure actually happen.

External proxy / router
cascadeflow
Vantage point
Request boundaries only
Every model call, tool call, and handoff
Latency
+40–60ms per call — 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 — 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, one for domains — so you can govern KPIs, cost routing, and compliance across your entire agent fleet.

Dedicated builder

Policy Builder

Go beyond the built-in six dimensions. Define custom scoring dimensions, KPI weights, and governance policies, then enforce them across every agent at runtime — with gradual rollouts and auto-rollback.

Dedicated builder

Domain Builder

Map each domain to its specialist model cascade and tune keyword + semantic routing visually — no 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 — 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 — cost routing, compliance rules, and quality bars enforced at every step.

Enterprise

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 that sits inside AI agent execution. It sees every step an agent takes — model calls, tool calls, and sub-agent handoffs — and steers each decision toward your policies and goals, scoring it 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 only see requests going in and out — they sit outside the agent. cascadeflow runs inside the agent execution, so it sees the actual decisions an agent makes and can steer them: switch models mid-run, deny a tool call, require approval, redact, retry, serve from cache, or stop execution. That in-loop visibility is the core difference.

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. Savings come from intelligent model cascading and domain-aware routing — classifying each query's domain and sending it to a specialist model cascade instead of 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 — a UI and CLI to run, set up, optimize, and adjust the agents you govern. Its Policy Builder and Domain Builder let you define, version, and enforce custom policies, KPIs, and domain cascades without writing enforcement code by hand.

What can cascadeflow enforce at runtime?+

Every agent step is scored across six built-in dimensions — cost, latency, quality, budget, compliance, and energy — plus any custom dimensions you define in Studio. cascadeflow then acts with eight enforcement actions: allow, switch_model, deny_tool, stop, retry, require_approval, redact, and serve_from_cache.

3,219GitHub stars
17K+downloads
671forks

Start governing every agent decision

Open source, MIT licensed, three lines of code. See and steer every agent step — and cut inference cost up to 90% along the way.

$ pip install cascadeflowGet started
or star us on GitHub →