Skip to main content
Create a scoped run context manager that tracks metrics and optionally enforces constraints for a block of agent execution.

Signature

Parameters

Returns

Context manager yielding HarnessRunContext. See HarnessRunContext.

Usage

Basic budget

Full configuration

Nested runs

Runs can be nested. Inner runs inherit the parent’s remaining budget:

Notes

  • run() requires init() to have been called first
  • Parameters override the global config for the duration of the block
  • Use session.summary() for aggregate metrics
  • Use session.trace() for per-step decision records