AI Kit workflows are built from typed steps (Documentation Index
Fetch the complete documentation index at: https://ai.aidalinfo.fr/llms.txt
Use this file to discover all available pages before exploring further.
createStep, createMapStep, …) chained through createWorkflow. Every run is observable, cancellable, and integrates with OpenTelemetry.
1. Install dependencies
zod is optional but recommended to strongly type your inputs and outputs.
2. Declare a step
- Aucun generic nécessaire : dès que vous fournissez
inputSchema/outputSchema, TypeScript infère automatiquement les types du handler. - Les steps restent compatibles avec tout workflow, même si celui-ci définit un
ctxou unmetadatatypé. Vous ne rajoutez des generics que si vous voulez du typage avancé (Meta,RootInput,Ctx) dans la step elle-même. - Si vous n’avez pas de schéma, vous pouvez toujours annoter manuellement (
createStep<MyInput, MyOutput>(...)), comme dans les versions précédentes.
3. Assemble a workflow
commit() returns an immutable Workflow. The output schema is applied to the value returned by the last step (or finalize when defined).
4. Run and inspect
Control execution
workflow.createRun()returns a reusableWorkflowRun.run.watch(listener)fires on every event (workflow:start,step:success,step:event, …).run.stream()exposes an async iterator so you can consume events in real time while awaiting completion.run.cancel()aborts the execution via anAbortSignal.
Shared metadata
Initialise shared metadata throughmetadata when starting the run. Access it inside a step with context.getMetadata() and update it via context.updateMetadata(). context.store exposes a shared Map to keep temporary references.
Execution context (ctx)
Carry a typed execution context between steps:
Choose your typing level
- Workflow without generics – Quick to write; TypeScript accepts any
inputData/ctx, so you can move fast without annotations:
- Workflow with explicit generics – Add
<Input, Output, Meta, Ctx>when you want IDE hints onctx, metadata or inputs. Steps declared with schemas remain plug-and-play; you never need to restate their generics.
5. Full example (agent + workflow)
context.emit events can feed a real-time interface while the run progresses.