Levain LabsLevain Labs
Platform

Harness

The loop that runs your agent.

The harness is the component that executes the agent. It reads the agent's next intended action, dispatches it, records the result in the session, and loops.

The cycle

  1. Decide. The agent chooses what to do next, given its instructions and the session so far.
  2. Act. The harness executes the action: a tool call, a resource read, or a write to the workspace.
  3. Observe. The result is appended to the session as an event.
  4. Repeat until the agent reports it's done, or a bound is hit.

Every iteration is auditable, every state transition is durable, and every effect is bounded.

Bounds

The harness enforces three hard limits on every run:

  • Wall-clock timeout. The run halts when it's reached.
  • Budget in USD. Token spend is tracked in real time; the run halts when the threshold is crossed.
  • Step count. The run halts at a maximum number of iterations.

These bounds are enforced by the platform and cannot be lifted by the agent.

Observability

While a run is in progress, the harness writes each step to the session. GET /runs/{id}/logs returns:

  • The action the agent chose.
  • The tool call it dispatched.
  • The result that came back.
  • Intermediate cost and token counters, updated live.

This is the primary surface for inspecting and optimizing agent behavior.

On this page