NylorunDocsBeta
BuildRunDeployReferenceMore

Harness

In-process run(), durable checkpoints, and model adapters.

@nylorun/harness/run · beta

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/runrun, RunBinding, BoundRunOptions, bindingFromAgent

NameTypeRequiredDescription
bindingRunBinding<Info>YesManifest plus local implementations.
inputExecutionInputYesUser message or a pause continuation.
onModelCallModelAdapterYesModel adapter for this invocation.
stateExecutionStateNoPrior returned state. Omit to start empty.
infoInfoNoHost identity for hooks and tools.
signalAbortSignalNoCooperative cancellation. Abort settles as cancelled.
onEvent(event: ExecutionEvent) => void | Promise<void>NoLive observations (not Runtime SSE).
record(state: ExecutionState) => void | Promise<void>NoAwaited 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/runrunDurable, createDurableCheckpoint, DurableHost, DurableCheckpoint, DurableResult

Rename map (no aliases): runHostedrunDurable, createHostedCheckpointcreateDurableCheckpoint, EngineHostDurableHost, EngineBindingRunBinding.

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.

On this page