Skip to main content
The complete public surface of @loop.js/core. If it isn’t on this page, it isn’t public.

Values

ExportWhat it isReference
LoopLoop.define(config) — pure function, returns a LoopDefinitionLoop.define
AgentAgent.define(config) — the ungraded sibling, returns an AgentDefinitionAgent.define
LoopBusythe startup error thrown when a live owner holds the Lock — carries pid and heartbeatAgeMsdefinition.run

Definition and handle types

TypeWhat it isReference
LoopConfigLoop.define’s input — only goal requiredLoop.define
AgentConfigAgent.define’s input — the Loop core minus convergenceAgent.define
LoopDefinitionwhat Loop.define returns: run() + status()Loop.define
AgentDefinitionwhat Agent.define returns: run() onlyAgent.define
LoopStatic / AgentStaticthe shapes of the Loop / Agent namespaces themselves
Runthe Loop run handle: AsyncIterable<LoopEvent> + cancel() + done(): Promise<Exit>definition.run
AgentRunthe same handle shape over AgentEvent / AgentExitAgent.define
RunOptionssignal, fresh, force, debug, and the yield-slicing rounds / deadlinedefinition.run
AgentRunOptionssignal and debug onlyAgent.define

Authoring types

TypeWhat it isReference
Promptone shape, three homes: a literal, { file }, or a per-round functionLoop.define
PromptCtxthe deliberately starved per-round context every function Prompt receivesLoop.define
ExecuteSpec / VerifySpecper-phase binding: prompt?, model?, permissions? — a phase key also takes a bare Prompt as shorthand for { prompt }Loop.define
Limitsrounds, usd, timeout — every field optionalLoop.define
AgentLimitsusd and timeout — no roundsAgent.define
Permissions"read" | "auto" | "bypass", resolved per phaseLoop.define

Result and status types

TypeWhat it isReference
Verdictthe Verify agent’s result — ok / not-ok-impossible, reason mandatoryConcepts: the Loop
VerdictWirethe flat { ok, impossible, reason } the verdict event carriesEvents
Exithow 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
LoopStatusthe disk snapshot status() returnsdefinition.status

Event types

TypeWhat it isReference
LoopEventthe full event union a Run yieldsEvents
AgentEventthe Agent run’s leaner union — no phase-start, no verdictEvents
EventEnvelope{ seq, round, phase } on every journaled Loop eventEvents
AgentEventEnvelopethe bare { seq } on every Agent eventEvents
CostPayload{ inputTokens, outputTokens, cachedInputTokens, usd } per stepEvents
Phase"execute" | "handoff" | "verify"Events
Time-valued fields (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.