Skip to main content
The cascadeflow harness is an in-process intelligence layer that wraps AI agent execution. It tracks, scores, and optionally enforces constraints across six dimensions for every LLM call and tool execution inside agent loops.

Six Dimensions

HarnessConfig

All harness behavior is configured through one object.

Activation

Decision Flow

For each LLM call or tool execution:
  1. Record model, step number, cumulative cost, latency, energy
  2. Check compliance: Is the model in the configured allowlist?
  3. Check hard caps: Budget, tool calls, latency, and energy.
  4. Score KPI dimensions: Quality, cost, latency, and energy weighted by kpi_weights or kpiWeights.
  5. Decide action: allow, switch_model, deny_tool, or stop.
  6. Enforce or log: Enforce in enforce mode, log only in observe mode.
  7. Append trace: Record the full decision for auditing.

Supported Models

The harness includes a built-in pricing table for 18 models across OpenAI, Anthropic, and Google. Unknown models are resolved via fuzzy matching (e.g. gpt-5-mini matches even before official pricing is announced). See Energy Tracking for the full pricing and energy coefficients table.
Getting started: Agent Harness | Agent Loop | Python API: HarnessConfig | TypeScript API: Harness