Implementation Details
How the v0.1.0-alpha SDK actually works, end to end, anchored on the shipped source.
Little Workflow: published on npm as little-workflow@0.2.0-alpha.1 (2026-10-06). Sections labeled UNRELEASED describe source-only changes. Release status
This section is a guided tour of the alpha SDK internals. The SDK Implementation Spec lists the contract; these pages walk through how that contract is implemented in the @little-stack/workflow package — every diagram traces a real path through the source.
If you only need to use the SDK, start with the Quickstart and Core Mental Model. Read on here if you want to extend, debug, or audit the runtime.
End-To-End View
The alpha SDK is one package shaped around a single loop: turn a WorkflowDefinition into a locked WorkflowVersion, execute it against Local World, and persist every result boundary so a kill can be resumed.
The shipped code in packages/little-workflow/src/ corresponds 1:1 to these stages:
| Stage | Source |
|---|---|
| Authoring + types | authoring.ts, schema.ts |
| Tool registry | tool-registry.ts |
| Compile pipeline | compiler.ts, compiler-lock.ts, canonical.ts |
| LWIR validation | lwir.ts, expressions.ts |
| Workflow harness AI SDK bridge | packages/little-harness/src/workflow-harness/workflow-harness.ts |
| Runtime loop | runtime.ts, run-state.ts |
| Outer-loop scheduler | outer-loop.ts |
| Local World | world.ts |
| Replay | replay.ts, run-state.ts |
| CLI | cli-core.ts, cli.ts |
How To Read This Section
The pages are ordered along the lifecycle of a workflow:
- Architecture — package layout, module dependency graph.
- Compile pipeline — how
compileWorkflow()turns a definition into a lockedWorkflowVersion. - LWIR internals — the JSON document the runtime executes, plus its validator.
- Planner output — what the AI planner actually emits, end to end.
- Expressions — the deterministic
{{ ... }}mini-language. - Runtime execution — step scheduling, harness dispatch, decision routing, outer-loop scheduler.
- Parallel — bounded fan-out, fan-in, branch resume.
- Event log — the SQLite/WAL durability layer.
- Local World storage — artifact manifests, blobs, run locks, outer-loop manifests.
- Replay — rebuilding state without re-calling external systems.
- AI SDK adapter — how planner and runtime bridge to the AI SDK.
Each page is short on purpose; cross-link rather than chase. If you find a gap between the diagrams and the source, the source wins — file an issue.