Reference Runner
Verist does not ship an orchestrator. This is a minimal runner loop to show where the kernel fits.
INFO
This is not production-grade. It is a reference for wiring.
What the runner does
- Load state
- Run a step
- Commit output + events
- Enqueue commands
- Capture artifacts
Minimal loop
ts
import { run, createSnapshotFromResult } from "verist";
for (;;) {
const job = await queue.take();
if (!job) continue;
const { step, input, identity } = job;
const extraArtifacts = [];
const result = await run(step, input, {
adapters,
workflowId: identity.workflowId,
workflowVersion: identity.workflowVersion,
runId: identity.runId,
onArtifact: (artifact) => {
if (
artifact.kind !== "step-output" &&
artifact.kind !== "step-commands"
) {
extraArtifacts.push(artifact);
}
},
});
if (!result.ok) {
await store.recordFailure(result.error);
continue;
}
await store.commit({
workflowId: result.value.workflowId,
runId: result.value.runId,
stepId: result.value.stepName,
expectedVersion: await store.currentVersion(result.value.runId),
output: result.value.output,
events: result.value.events,
});
for (const cmd of result.value.commands ?? []) {
await queue.enqueue(cmd);
}
const snapshot = await createSnapshotFromResult(result.value, {
artifacts: extraArtifacts,
});
await snapshotStore.save(snapshot);
}Notes
- Capture artifacts only if you need replay/recompute
- Commands are auto-captured; use
captureCommands: falseto suppress - Keep state in your DB; the kernel is stateless by design
See Anti-Patterns for common mistakes to avoid when building a runner.