Skip to main content
A flow is a composable pipeline of document processing operations. Flows define the sequence of steps to transform raw documents into structured data.

What is a Flow?

Flows connect nodes together to form processing pipelines:
  • Linear execution chain: Steps run sequentially by default
  • Type-safe data passing: TypeScript ensures outputs match expected inputs
  • Stateful context: Each step can access outputs from previous steps
  • Built-in metrics: Automatic cost and duration tracking

Flow Builder Pattern

Flows use a fluent API for declarative pipeline definition:

Key Methods

Execution Patterns

Sequential Processing

Default pattern—each step runs after the previous completes:

Conditional Routing

Route documents based on previous step output:

Parallel Processing

Process arrays of documents in parallel:

Flow Results

Every flow execution returns:

Accessing Results

Flow Context

Each step has access to the flow context:
Use context in conditional logic:

Flow Composition

Reusing Flows

Flows can be defined once and reused:

Nested Flows

Use flows inside forEach:

Common Flow Patterns

Simple Extraction

OCR + Extraction

Multi-Document Bundle

Quality-Based Routing

Route based on document quality assessment:
For complex multi-step conditional paths, use trigger with nested flows:

Next Steps

Flows Reference

Detailed flow builder API

Schemas

Define extraction schemas