Documentation Index
Fetch the complete documentation index at: https://docs.bastani.ai/llms.txt
Use this file to discover all available pages before exploring further.
defineWorkflow is the entry point. The chain is:
.compile() is required — it seals the workflow definition. Once compiled, step order, session names, and the execution graph are immutable.
Minimal example
With structured inputs
WorkflowInput shape.
Definition fields
Workflow name — unique within the registry.
Human-readable description; shown in the picker and
atomic workflow list.Optional declared input schema. Each input becomes a
--<name>=<value> CLI flag with validation. See inputs.Pass
import.meta.path. The SDK uses this to re-import the workflow module inside the orchestrator child process — required when running through atomic’s built-in dispatcher or hostLocalWorkflows.Optional minimum SDK version. The runtime throws
IncompatibleSDKError if the loaded SDK is older..for(agent)
Pin the workflow to one agent. The agent type must be "claude", "copilot", or "opencode". Most repos ship per-agent variants of the same workflow side-by-side:
.run(fn)
The body. fn receives a WorkflowContext:
| Property | Type | Description |
|---|---|---|
ctx.inputs | { [K in N]?: string } | Typed inputs — only declared field names are valid keys. Workflows that need a prompt must declare it in their inputs schema. |
ctx.agent | AgentType | "claude" | "copilot" | "opencode". |
ctx.stage(opts, clientOpts, sessionOpts, fn) | Promise<SessionHandle<T>> | Spawn a session — returns a handle with name, id, result. |
ctx.transcript(ref) | Promise<Transcript> | Get a completed session’s transcript ({ path, content }). |
ctx.getMessages(ref) | Promise<SavedMessage[]> | Get a completed session’s raw native messages. |
ctx.stage and the per-callback s surface.
.compile()
Terminal method. Freezes the definition.
| Rule |
|---|
Every workflow definition must call .run() and .compile(). |
| Session names must be unique within a workflow run. |
transcript() / getMessages() only access completed sessions (callback returned + saves flushed). |
| Each session runs in its own tmux window with the chosen agent. |
To execute, call runWorkflow({ workflow, inputs }) from your CLI library of choice. |