@loop.js/core. If it isn’t on this page, it isn’t public.
Values
| Export | What it is | Reference |
|---|---|---|
Loop | Loop.define(config) — pure function, returns a LoopDefinition | Loop.define |
Agent | Agent.define(config) — the ungraded sibling, returns an AgentDefinition | Agent.define |
LoopBusy | the startup error thrown when a live owner holds the Lock — carries pid and heartbeatAgeMs | definition.run |
Definition and handle types
| Type | What it is | Reference |
|---|---|---|
LoopConfig | Loop.define’s input — only goal required | Loop.define |
AgentConfig | Agent.define’s input — the Loop core minus convergence | Agent.define |
LoopDefinition | what Loop.define returns: run() + status() | Loop.define |
AgentDefinition | what Agent.define returns: run() only | Agent.define |
LoopStatic / AgentStatic | the shapes of the Loop / Agent namespaces themselves | — |
Run | the Loop run handle: AsyncIterable<LoopEvent> + cancel() + done(): Promise<Exit> | definition.run |
AgentRun | the same handle shape over AgentEvent / AgentExit | Agent.define |
RunOptions | signal, fresh, force, debug, and the yield-slicing rounds / deadline | definition.run |
AgentRunOptions | signal and debug only | Agent.define |
Authoring types
| Type | What it is | Reference |
|---|---|---|
Prompt | one shape, three homes: a literal, { file }, or a per-round function | Loop.define |
PromptCtx | the deliberately starved per-round context every function Prompt receives | Loop.define |
ExecuteSpec / VerifySpec | per-phase binding: prompt?, model?, permissions? — a phase key also takes a bare Prompt as shorthand for { prompt } | Loop.define |
Limits | rounds, usd, timeout — every field optional | Loop.define |
AgentLimits | usd and timeout — no rounds | Agent.define |
Permissions | "read" | "auto" | "bypass", resolved per phase | Loop.define |
Result and status types
| Type | What it is | Reference |
|---|---|---|
Verdict | the Verify agent’s result — ok / not-ok-impossible, reason mandatory | Concepts: the Loop |
VerdictWire | the flat { ok, impossible, reason } the verdict event carries | Events |
Exit | how a Run ended: { settled: true, verdict } or { settled: false, cause, reason } | definition.run |
InterruptCause | "budget" | "rounds" | "cancel" | "error" | "yield" | definition.run |
AgentExit | { finished: true, reason } or { finished: false, cause, reason } | Agent.define |
LoopStatus | the disk snapshot status() returns | definition.status |
Event types
| Type | What it is | Reference |
|---|---|---|
LoopEvent | the full event union a Run yields | Events |
AgentEvent | the Agent run’s leaner union — no phase-start, no verdict | Events |
EventEnvelope | { seq, round, phase } on every journaled Loop event | Events |
AgentEventEnvelope | the bare { seq } on every Agent event | Events |
CostPayload | { inputTokens, outputTokens, cachedInputTokens, usd } per step | Events |
Phase | "execute" | "handoff" | "verify" | Events |
limits.timeout, RunOptions.deadline, loop cron --expires) all
speak one duration grammar — a whole number with a unit: "45s", "90m", "36h", "7d";
fields typed number | Duration also read a bare number of seconds.