Install
npm install @llamaindex/workflow @llamaindex/core zodEvent-driven agentic workflows for TypeScript. Use @llamaindex/workflow to model agents as typed events and handlers. First-class RAG, query engines, and agent coordination — all with TypeScript types.
Install
npm install @llamaindex/workflow @llamaindex/core zodVersion
@llamaindex/workflow 1.1.25 · May 2026 · Node 18+
Best for
Typed event-driven agents, full-stack RAG apps, browser-compatible flows.
runWorkflow() and runAndCollect() are now @deprecated. Use run(workflow, event).until(stopEvent).toArray() instead.handle() mutates the workflow in place and returns void — method chaining is not supported.(ctx, ...events): the first argument is the workflow context; subsequent arguments are the matched input events in order.@llamaindex/core 0.6.23 (a peer dependency) is marked deprecated in its package metadata; it is still required by this version of @llamaindex/workflow.@llamaindex/workflow 1.1.25 uses a functional API — createWorkflow, workflowEvent, run. Earlier drafts of this page documented a class-based extends Workflow + @step() decorator pattern and a chained .handle() call — neither exists in the current package.
import { createWorkflow, workflowEvent, run } from '@llamaindex/workflow';import { z } from 'zod';
// Define typed eventsconst startEvent = workflowEvent({ data: z.object({ input: z.string() }) });const stopEvent = workflowEvent({ data: z.object({ result: z.string() }) });
// Build the workflow — handle() mutates in place; it does not return the workflowconst workflow = createWorkflow();workflow.handle([startEvent], async (ctx, start) => { return stopEvent.with({ result: `Echo: ${start.data.input}` });});
// Run using the stream API — runWorkflow() is deprecated since 1.1.25const events = await run(workflow, startEvent.with({ input: 'Hello!' })) .until(stopEvent) .toArray();console.log(events.at(-1)?.data); // { result: 'Echo: Hello!' }For multi-agent topologies use multiAgent(...) + FunctionAgent. For streaming use run(...).toStream() or iterate the return value of run(...) directly.
Ready? Start Zero → Hero Step 1 →
| Date | Version | Changes |
|---|---|---|
| 2026-05-04 | @llamaindex/workflow 1.1.25 | Bumped 1.1.24 → 1.1.25. Fixed broken minimal example: corrected handler signature to (ctx, start) (was incorrectly ({ data })); removed unsupported chaining on handle(); replaced deprecated runWorkflow() with run().until().toArray(). Added “What’s new in 1.1.25” section documenting runWorkflow deprecation and handle() void-return behaviour. Snippet executed against installed 1.1.25 in .routine-envs/check-0504-node. |
| 2026-04-21 | 1.1.24 | Minimal example rewritten against functional API (createWorkflow/workflowEvent/runWorkflow) after pkg introspection — class + @step pattern documented earlier does not exist. |
| April 2026 | 1.1.24 | Scoped package migration; typed event handlers stabilised. |
Note: Python implementation lives at LlamaIndex (Python).