Skip to main content
The TypeScript harness instruments OpenAI and Anthropic SDK calls made inside a scoped run. It can record decisions in observe mode or apply them in enforce mode.

Initialize

Configuration precedence is explicit code, environment variables, cascadeflow.json or cascadeflow.config.json, and built-in defaults.

Scoped Run

run() takes an optional policy object and a callback. The callback receives the active HarnessRunContext.
Node.js uses AsyncLocalStorage to preserve nested and concurrent run context.

Run Options

kpiWeights affects built-in model selection. kpiTargets is retained as policy metadata but is not currently used by the built-in scoring decision.

Summary and Trace

See Decision Traces for the complete field mapping.

Function Policy Metadata

The root package exports the harness function wrapper as harnessAgent to avoid a naming conflict with CascadeAgent.
harnessAgent() attaches policy metadata. It does not create a scoped run automatically.

Errors and Reset

Current Instrumentation Scope

See Feature Parity before relying on Python examples in a TypeScript application.