TypeScript SDK for the iterion
workflow orchestration engine. The SDK is a thin, typed wrapper around
the iterion CLI binary — every method shells out and parses the
--json output into typed result objects.
pnpm add @iterion/sdk
# or
npm install @iterion/sdkYou also need the iterion binary on your machine. Either install it
(release page) and
make sure it is on PATH, or set the ITERION_BIN environment variable
to its absolute path.
import { IterionClient } from "@iterion/sdk";
const iterion = new IterionClient({ storeDir: ".iterion" });
const result = await iterion.run("examples/clarify/main.bot", {
vars: {
transcript: "User A: ship it. User B: ship what?",
latest_message: "User B: ship what?",
thread_id: "thread-1",
},
logLevel: "info",
});
// By default `run()` throws on `status: "failed"` (see throwOn below).
switch (result.status) {
case "finished":
console.log("done", result.run_id);
break;
case "paused_waiting_human":
console.log("waiting for", result.questions);
break;
case "cancelled":
console.warn("cancelled");
break;
}To opt out of the default throw-on-failed behaviour and inspect the
failed result directly, pass { throwOn: [] } (or any non-empty
subset of "failed" | "cancelled" | "paused_waiting_human").
const ac = new AbortController();
for await (const evt of iterion.events(result.run_id, { follow: true, signal: ac.signal })) {
console.log(evt.type, evt.node_id ?? "");
}const resumed = await iterion.resume({
runId: result.run_id,
file: "bots/whats-next/main.bot",
answers: { approve: true, notes: "looks good" },
});The public surface is documented in source under src/:
IterionClient— façade withrun,resume,inspect,validate,diagram,report,init,version,events, plus store helpersloadRun,loadInteraction,loadArtifact,listRuns.IterionRuntimeError,IterionInvocationError,IterionBinaryNotFoundError,IterionRunPausedSignal— structured errors.tailEvents,resolveBinary,detectPlatform— exported helpers for advanced use.
The SDK is versioned independently (0.1.x at the time of this checkout) and
tracks the CLI JSON/persisted-format contracts in the same Iterion repository.
Use matching SDK and CLI releases; both surfaces remain experimental and may
change before a stable compatibility policy is declared.
MIT.