Examples
Runnable code that shows the framework in action.
Quickstart
Quickstart: one field, one flow, one turn.
typescriptFields
Fields: authored once, asked in any order, each with its own wording.
`ask``enum``extract: 'asked'``maxAsks`a step's own `ask`
typescriptTools
Tools: functions the AI may call while it speaks.
`Tool.handler(argsctx)` → `{ valuedata }``isReadOnly`
typescriptInstructions
Instructions: behavioural rules the AI follows while they apply.
`kind` must/never/should`when` (judged by the AI)`if` (judged
typescriptBranches
Branches: leaving a step early, by the AI or by code.
`branches[]` with `when` (AI) and `if` (code)`then` as a step
typescriptTriggers And Waits
Triggers and waits: flows that start without a message, and steps that
`f.action``f.event``f.condition`; `silence``event` +
typescriptStreaming
Streaming: the reply arrives token by token, the result at the end.
`agent.turnStream``{ delta }` chunksthe `{ doneresult }`
typescriptStore And Migration
Persistence: load, turn, save, and the one-time move of a 3.x session.
`Store``MemoryStore``save(sessionexpectedVersion)`
typescriptFlows From Json
Flows as JSON: store them in a database, let an editor draw them, let a
`FlowSpec``f.fromSpec``toSpec``validateFlow`
typescript