Agent Harness
The Harness is the core of cascadeflow’s runtime intelligence. It wraps agent execution and makes a decision at every step — should this model call proceed, be switched, or be stopped?What the Harness Does
At every LLM call or tool execution inside an agent loop, the Harness:- Checks hard constraints — budget remaining, compliance allowlist, tool call cap, latency limit, energy limit
- Scores soft dimensions — quality, cost, latency, energy weighted by KPI priorities
- Decides an action —
allow,switch_model,deny_tool, orstop - Records a trace — action, reason, model, step, cost, budget state
observe mode, decisions are recorded but not enforced. In enforce mode, they shape execution in real time.
HarnessConfig — The Full Control Surface
All Harness behavior is configured through a single dataclass:The Three-Tier API
cascadeflow offers three levels of control — use the one that fits your needs:Tier 1: Global Init (Zero-Change)
Tier 2: Scoped Run (Block-Level Control)
Tier 3: Agent Decorator (Per-Agent Policy)
Decision Priority
When the Harness evaluates a step, it follows a strict priority order:
Hard constraints (budget, compliance) always take priority over soft scoring (KPI weights).
Six Dimensions at a Glance
Observe vs Enforce
Start with
observe to validate your policies against real traffic. Switch to enforce when you are confident the rules are correct.