Skip to main content

LlamaIndex Workflows

LlamaIndex Workflows are a framework for orchestrating and chaining together complex systems of steps and events.

What can you build with Workflows?

Workflows shine when you need to orchestrate complex, multi-step processes that involve AI models, APIs, and decision-making. Here are some examples of what you can build:

  • AI Agents - Create intelligent systems that can reason, make decisions, and take actions across multiple steps
  • Document Processing Pipelines - Build systems that ingest, analyze, summarize, and route documents through various processing stages
  • Multi-Model AI Applications - Coordinate between different AI models (LLMs, vision models, etc.) to solve complex tasks
  • Research Assistants - Develop workflows that can search, analyze, synthesize information, and provide comprehensive answers
  • Content Generation Systems - Create pipelines that generate, review, edit, and publish content with human-in-the-loop approval
  • Customer Support Automation - Build intelligent routing systems that can understand, categorize, and respond to customer inquiries

The async-first, event-driven architecture makes it easy to build workflows that can route between different capabilities, implement parallel processing patterns, loop over complex sequences, and maintain state across multiple steps - all the features you need to make your AI applications production-ready.

Key Features

  • async-first - workflows are built around python's async functionality - steps are async functions that process incoming events from an asyncio queue and emit new events to other queues. This also means that workflows work best in your async apps like FastAPI, Jupyter Notebooks, etc.
  • event-driven - workflows consist of steps and events. Organizing your code around events and steps makes it easier to reason about and test.
  • state management - each run of a workflow is self-contained, meaning you can launch a workflow, save information within it, serialize the state of a workflow and resume it later.
  • observability - workflows are automatically instrumented for observability, meaning you can use tools like Arize Phoenix and OpenTelemetry right out of the box.

Quick Start

Install the package:

pip install llama-index-workflows

And create your first workflow:

import asyncio
from pydantic import BaseModel, Field
from workflows import Context, Workflow, step
from workflows.events import Event, StartEvent, StopEvent

class MyEvent(Event):
    msg: list[str]

class RunState(BaseModel):
    num_runs: int = Field(default=0)

class MyWorkflow(Workflow):
    @step
    async def start(self, ctx: Context[RunState], ev: StartEvent) -> MyEvent:
        async with ctx.store.edit_state() as state:
            state.num_runs += 1

            return MyEvent(msg=[ev.input_msg] * state.num_runs)

    @step
    async def process(self, ctx: Context[RunState], ev: MyEvent) -> StopEvent:
        data_length = len("".join(ev.msg))
        new_msg = f"Processed {len(ev.msg)} times, data length: {data_length}"
        return StopEvent(result=new_msg)

async def main():
    workflow = MyWorkflow()

    # [optional] provide a context object to the workflow
    ctx = Context(workflow)
    result = await workflow.run(input_msg="Hello, world!", ctx=ctx)
    print("Workflow result:", result)

    # re-running with the same context will retain the state
    result = await workflow.run(input_msg="Hello, world!", ctx=ctx)
    print("Workflow result:", result)


if __name__ == "__main__":
    asyncio.run(main())

In the example above

  • Steps that accept a StartEvent will be run first.
  • Steps that return a StopEvent will end the workflow.
  • Intermediate events are user defined and can be used to pass information between steps.
  • The Context object is also used to share information between steps.

Visit the complete documentation for more examples using llama-index!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_workflows-2.23.3.tar.gz (138.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_workflows-2.23.3-py3-none-any.whl (166.8 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_workflows-2.23.3.tar.gz.

File metadata

  • Download URL: llama_index_workflows-2.23.3.tar.gz
  • Upload date:
  • Size: 138.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_workflows-2.23.3.tar.gz
Algorithm Hash digest
SHA256 fba140ea4d4aa7e7ca58f3ddc2526b92bfb31bfaf45ab2b4345401ae527061b4
MD5 a76bf02129851e58dd2462d31c44d8de
BLAKE2b-256 74f8cb9968d2453b16dc8951b8542ea827a59b937ecb0aa1a06d3ca418a311f4

See more details on using hashes here.

File details

Details for the file llama_index_workflows-2.23.3-py3-none-any.whl.

File metadata

  • Download URL: llama_index_workflows-2.23.3-py3-none-any.whl
  • Upload date:
  • Size: 166.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_workflows-2.23.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d7ad51363ba4817b4140526c5e785d2f143861f618823456e2f379adfe0b321b
MD5 f8bf29b3901177ee365c84b96d82e982
BLAKE2b-256 bf3527a651cee0c4e4540a5b65aaec1293f52e153b870accab7f8472d035809b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.23.3 This release

2 files

2.23.2

2 files

2.23.1

2 files

2.23.0

2 files

2.22.2

2 files

2.22.1

2 files

2.22.0

2 files

2.21.0

2 files

2.20.0

2 files

2.19.1

2 files

2.19.0

2 files

2.18.0

2 files

2.17.3

2 files

2.17.1

2 files

2.17.0

2 files

2.16.1

2 files

2.16.0

2 files

2.15.1

2 files

2.15.0

2 files

2.14.2

2 files

2.14.1

2 files

2.14.0

2 files

2.13.1

2 files

2.13.0

2 files

2.12.2

2 files

2.12.1

2 files

2.12.0

2 files

2.11.7

2 files

2.11.6

2 files

2.11.5

2 files

2.11.4

2 files

2.11.3

2 files

2.11.2

2 files

2.11.1

2 files

2.11.0

2 files

2.10.3

2 files

2.10.2

2 files

2.10.1

2 files

2.10.0

2 files

2.9.1

2 files

2.9.0

2 files

2.8.3

2 files

2.8.2

2 files

2.8.1

2 files

2.8.0

2 files

2.7.1

2 files

2.7.0

2 files

2.6.0

2 files

2.5.0

2 files

2.4.0

2 files

2.3.0

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page