Core Concepts
Foundational components of event-driven query and document orchestration.
Event-Driven Control
Runs on an event bus pattern. Steps yield event objects that automatically trigger subsequent tasks, allowing non-linear flows and concurrency loops.
Shared Context memory
Use the workflow context object (`ctx`) to read or write keys (`ctx.set`/`ctx.get`) across separate step executions safely.
Parallel Execution
Spawn multiple steps in parallel simply by mapping decorators to the same input Event. The workflow runs them concurrently.
Custom Event Streams
Stream intermediate milestones from steps using `ctx.send_event(Event)`. Useful for displaying retrieval progress to frontends.
Human-in-the-Loop Gating
Pause step executions to wait for external approval using `await ctx.get_input("key")`, continuing logic once payload is submitted.
Error Recovery Loops
If retrieved document context is graded insufficient by a step, the workflow automatically fires a query-refinement event to search again.
Setup & Installation
Configure LlamaIndex workflows for event-driven search routines.
Install Core packages
Event-Driven Workflow Code
Defining custom Events, context variables, parallel step runs, streaming progress, and launching the thread.