Skip to content

LlamaIndex (TypeScript)

Event-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

Terminal window
npm install @llamaindex/workflow @llamaindex/core zod

Version

@llamaindex/workflow 1.1.25 · May 2026 · Node 18+

Best for

Typed event-driven agents, full-stack RAG apps, browser-compatible flows.

What’s new in @llamaindex/workflow 1.1.25 (May 2026)

Section titled “What’s new in @llamaindex/workflow 1.1.25 (May 2026)”
  • 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.
  • Handler signature is (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 APIcreateWorkflow, 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 events
const 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 workflow
const 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.25
const 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 →


DateVersionChanges
2026-05-04@llamaindex/workflow 1.1.25Bumped 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-211.1.24Minimal example rewritten against functional API (createWorkflow/workflowEvent/runWorkflow) after pkg introspection — class + @step pattern documented earlier does not exist.
April 20261.1.24Scoped package migration; typed event handlers stabilised.

Note: Python implementation lives at LlamaIndex (Python).