Harness
In-process run(), durable checkpoints, and model adapters.
Advanced: in-process engine
import { run, bindingFromAgent } from "@nylorun/harness/run";
const result = await run({
binding: bindingFromAgent(agent.build()),
input,
state,
onModelCall: adapter,
info,
signal,
onEvent,
record,
});run() is the public engine surface. It returns Promise<RunResult>.
Application definitions have no .run(). The /engine specifier and
hosted-execution names are gone; use /run and the durable names below.
This page is advanced host guidance. The taught application path is sessions plus a connected executor.
BoundRunOptions and RunBinding
Access: @nylorun/harness/run → run, RunBinding, BoundRunOptions,
bindingFromAgent
| Name | Type | Required | Description |
|---|---|---|---|
binding | RunBinding<Info> | Yes | Manifest plus local implementations. |
input | ExecutionInput | Yes | User message or a pause continuation. |
onModelCall | ModelAdapter | Yes | Model adapter for this invocation. |
state | ExecutionState | No | Prior returned state. Omit to start empty. |
info | Info | No | Host identity for hooks and tools. |
signal | AbortSignal | No | Cooperative cancellation. Abort settles as cancelled. |
onEvent | (event: ExecutionEvent) => void | Promise<void> | No | Live observations (not Runtime SSE). |
record | (state: ExecutionState) => void | Promise<void> | No | Awaited persistence barrier. |
bindingFromAgent(agent) builds a RunBinding from an authored BuiltAgent.
Bindings contain local functions and are not a wire format.
Statuses: completed | paused | cancelled | failed. Each returns
serializable state.
Durable execution
Access: @nylorun/harness/run → runDurable, createDurableCheckpoint,
DurableHost, DurableCheckpoint, DurableResult
Rename map (no aliases): runHosted → runDurable,
createHostedCheckpoint → createDurableCheckpoint,
EngineHost → DurableHost, EngineBinding → RunBinding.
Durable execution reconstructs progress from a checkpoint and individually
journaled effect outcomes. Engine version is hosted-2. Checkpoint
version is 1. Protocol version is 1. Manifest schema is 4.
A hook effect runs one hook point for every capability that registered it.
Effect ids use stable names (before-turn, before-step:<stepId>,
after-step:<stepId>, after-turn:<stepId>).
Model adapters
Custom hosts supply onModelCall. Translators for provider wire formats live
on @nylorun/harness for host authors. Application users configure the
provider in the Runtime vault, not on the agent.
Guide: HOST_CONTRACT.md.