Llamaindex workflows examples. Jun 2, 2025 · A comprehensive guide for building file chat agents using LlamaIndex Workflows and A2A Protocol. This way, the Converting a Workflow to an MCP App If you have a custom Workflow, you can convert it to an MCP app using the workflow_as_mcp function. Welcome to this interactive tutorial designed to introduce you to LlamaIndex Workflow and its integration with MLflow. But The Workflow Itself With our events defined, we can construct our workflow and steps. New documents can be added with each new set being managed by a sub-agent. Function Calling and Tool Use: Check out our OpenAI, Mistral guides as examples. Router Query Engine RouterQueryEngine chooses the most appropriate query engine from multiple options to process a given query. To provide your user with a good experience, you may want to provide an indication of progress by streaming events as they occur. Workflows have built-in support for this on the Context object. The goal of LlamaDeploy is to Sep 5, 2024 · Now we have dovetailed the two mechanisms, producing llama-deploy , which combines the ease of building LlamaIndex Workflows with a simple, native deployment mechanism for them. This video walks through a concrete example of getting started, evaluating and tracing an agent. Use Cases LlamaIndex offers powerful capabilities for a wide range of AI applications. Let's get Workflows cookbook: walking through all features of Workflows First, we install our dependencies. Core contains most of what we need; OpenAI is to handle LLM access and utils-workflow provides the visualization capabilities we'll use later on. Combined with MLflow, the Workflow API brings efficiency and robustness in the development cycle, enabling easy debugging, experiment tracking, and evaluation for continuous improvement. This notebook walks through implementation of Router Query Engine, using workflows. Simpler Agentic Strategies These include routing and query transformations. Contrast this with the term "agentic", which generally refers to a superclass of agents, which is any system with LLM decision making in the process. Dec 16, 2024 · LlamaIndex workflows streamline the orchestration of complex query pipelines by offering a modular, structured approach, enabling more efficient and flexible execution of tasks. This example adapts the agent from examples/11_rag. Query Planning: Routing, Sub-Questions, Query Transformations. This workflow is useful for any system that needs iterative planning to answer a user's query, as it decomposes a query into smaller steps, executes those steps, and aggregates the results. Workflows are made up of handlers, with each one responsible for processing specific event types and emitting new events. This is useful when you have multiple steps that can be run independently of each other and they have time-consuming operations that they await, allowing other steps to run in parallel. llama-deploy builds on the ideas and code of llama-agents , which has been folded into the new repo. Workflows are made up of steps, with each step responsible for handling certain event types and emitting new events. Jan 22, 2025 · Complex coordination logic between components Difficulty maintaining state and context Brittle handoffs between different stages Limited visibility into the system's operation After introducing Workflows in LlamaIndex, these types of systems became much easier to build. Includes detailed implementation of file upload and parsing, multi-turn conversations, real-time streaming, inline citations, LlamaParse and OpenRouter integration, and webhook notification systems. To get this done, let's bring in all the In LlamaIndex, you can either build your own agentic workflows from scratch, covered in the "Building Workflows" section, or you can use our pre-built agentic workflows like FunctionAgent (a simple function/tool calling agent) or AgentWorkflow (an agent capable of managing multiple agents). It has two stages for the given task: STAGE-1: a. This enables building complex agent systems where different agents handle different aspects of a task. Two special types of predefined events StartEvent and StopEvent controls the entry and exit points of the workflow. . However, to be able to achieve the same functionality in a user-friendly interface, we need additional modifications to the original workflow. Specifically we will implement RouterQueryEngine. LlamaIndex Workflows propose a different approach to the issue of splitting tasks into different agents by introducing a steps-and-events architecture. SELECT: Selects subset of reasoning Modules. Building with LlamaIndex typically involves working with LlamaIndex core and a chosen set of integrations (or plugins). Aug 1, 2024 · After each run_step call, the workflow can be inspected, examining any intermediate results or debug logs. g. Deployment In LlamaDeploy each workflow is wrapped in a Service object, endlessly processing Streaming events Workflows can be complex -- they are designed to handle complex, branching, concurrent logic -- which means they can take time to fully execute. As shown in the diagram below: First the quality of the query is judged. , title, author Jan 15, 2025 · LlamaIndex is a simple, flexible framework for building knowledge assistants using LLMs connected to your enterprise data. In this example, we'll create a simple workflow with a single FunctionAgent, and use that to cover the basic functionality. Feb 12, 2025 · Explore how to build a Multi-Agent Workflow for automated research, writing, and reviewing with AI-driven agents and workflows. Steps can be "bound" when they are defined as methods of the Workflow class itself, or "unbound" when they are defined as free functions. This is used to infer the input and output types of each workflow for validation, and ensures Dec 15, 2024 · Deep Dive into LlamaIndex Workflows: Event-driven LLM architecture. By following the provided examples, you can build your own workflows tailored to your specific needs. Sep 14, 2024 · To overcome the above issues LlamaIndex proposed a new paradigm shift in design leading to even driven architecture called Workflows. For example, a step of a Workflow may need human expertise or input in order to run. When building agentic workflows, building and managing prompts is a key part of the development process. The implementation is An event-driven abstraction used to orchestrate the execution of different components called "steps". With LlamaDeploy, you can build any number of workflows in llama_index and then run them as services, accessible through a HTTP API by a user interface or other services part of your system. Once a plan is executed, we can use the results to form a final response to the user's query or to form Sep 10, 2024 · LlamaIndex offers several notebook examples and video series that cover these concepts in more detail. Query-Time Sample Row retrieval: Embed/Index each row, and dynamically retrieve example rows for each table in the text-to-SQL prompt. For example, let's use the following workflow that will make a string loud: Deploying Workflows Building with Agentic Ingredients If you want to leverage core agentic ingredients in your workflow, LlamaIndex has robust abstractions for every agent sub-ingredient. Each step is responsible for handling certain event types and possibly emitting new events. A starter Python package that includes core LlamaIndex as well as a selection of integrations. Mar 7, 2025 · Explore the innovative LlamaIndex AgentWorkflow framework through a practical example. b. For example, let's say you have Multi-Agent Workflows The AgentWorkflow uses Workflow Agents to allow you to create a system of one or more agents that can collaborate and hand off tasks to each other based on their specialized capabilities. MultiStep Query Engine The MultiStepQueryEngine breaks down a complex query into sequential sub-questions. We even built our own multi-agent example! Oct 25, 2024 · LlamaIndex Workflow is a great framework to build such compound systems. - run-llama/llama_index Introduction What is context augmentation? What are agents and workflows? How does LlamaIndex help build them? Use cases What kind of apps can you build with LlamaIndex? Who should use it? Getting started Get started in Python or TypeScript in just 5 lines of code! LlamaCloud Managed services for LlamaIndex including LlamaParse, the world's best document parser. Jan 28, 2025 · Today, I will show you how to use LlamaIndex Workflow to implement a multi-agent orchestration feature similar to OpenAI Swarm, using a customer service chatbot project as an example. This is a full-stack demonstration of how to build a LlamaIndex workflow that uses a human in the loop. Feb 9, 2025 · What is LlamaIndex? LlamaIndex (formerly GPT Index) is an AI framework designed for indexing, querying, and managing structured and unstructured data for LLM-powered applications. In the remaining examples in this tutorial we will assume an async environment for simplicity. In this example, we create a simple workflow with two steps: one that pre-processes an incoming event and another that generates a reply. Multi-agent patterns in LlamaIndex When more than one specialist is required to solve a task you have several options in LlamaIndex, each trading off convenience for flexibility. Emitting multiple events In our examples so far, we've only emitted one event from each step. Specifically, we will create a system that can generate a report on a given topic. This is useful for tasks that require human input, such as confirming a tool call or providing feedback. The basic structure of LlamaIndex’s approach Nov 22, 2024 · This article continues our exploration of LlamaIndex workflows, an integral part of the Gentle Introduction to the Multi-Agent Multiverse series. Such a workflow is created by defining Steps which are triggered by Events, and themselves emit Events to trigger further steps. Function calling agents work by using an LLM that supports tools/functions in its API (OpenAI, Ollama, Anthropic, etc. 🦙 llama_deploy 🤖 llama_deploy (formerly llama-agents) is an async-first framework for deploying, scaling, and productionizing agentic multi-service systems based on workflows from llama_index. In today's article, we'll take a deep dive into this feature through a practical mini-project, exploring what's new and still lacking. Multi-agent concierge system This repo contains an implementation of a multi-agent concierge system using LlamaIndex's Workflows abstraction. To define a step, the method or function must be decorated with Corrective RAG Workflow This notebook shows how to implement corrective RAG using Llamaindex workflows based on this paper A brief understanding of the paper: Corrective Retrieval Augmented Generation (CRAG) is a method designed to enhance the robustness of language model generation by evaluating and augmenting the relevance of retrieved documents through an evaluator and large-scale web Multi-strategy workflow with reflection In this notebook we'll demonstrate a workflow that attempts 3 different query strategies in parallel and picks the best one. Ecosystem LlamaIndex Workflow makes asynchronous operations a first-class feature, enabling easy parallel execution and scalable workflows. Conclusion This project gives you a closer look into a LlamaIndex RAG pipeline and highlights the capabilities of LlamaIndex Workflow in creating custom RAG systems. (if you want to check out our text-to-SQL guide using these modules, take a look here). Learn how to create intelligent systems that react to events and automate complex tasks with LLMs. By setting the num_workers parameter in @step decorator, we can control the number of steps executed simultaneously, enabling efficient parallel processing. Another essential component of the workflow is the Context object. Using this example, you can plug in your own agents and tools to build your own multi-agent system, or hack and extend the underlying code to suit your needs. This simplifies the design compared to similar methodologies based on DAG (Directed Acyclic Jun 25, 2025 · LlamaIndex Workflows LlamaIndex Workflows are a framework for orchestrating and chaining together complex systems of steps and events. The goal of LlamaDeploy is to Jan 30, 2024 · The topic of Agentic RAG explores how agents can be incorporated into existing RAG pipelines for enhanced, conversational search and retrieval. LlamaIndex provides a flexible and powerful way to manage prompts, and to use them in a variety of ways. Our workflow will be stateful with memory, and will be able to call the LLM to select tools and process incoming user messages. Step 4: Create a Simple LlamaIndex Workflows Application In LlamaIndex Workflows, you build event-driven AI agents by defining steps with the @step decorator. Here's a diagram of the steps (in blue) that make up an Agent Workflow + Research Assistant using AgentQL In this tutorial, we will use an AgentWorkflow to build a research assistant OpenAI agent using tools including AgentQL's browser tools, Playwright's tools, and the DuckDuckGoSearch tool. React calling agents work by prompting an LLM to either invoke tools/functions, or return a final response. In llama_deploy, each workflow is seen as a service, endlessly Dec 17, 2024 · Recently, LlamaIndex introduced a new feature called Workflow in one of its versions, providing event-driven and logic decoupling capabilities for LLM applications. To create an agent in LlamaIndex, it takes only a few lines of code: This tutorial will show how to use step-back prompting with LlamaIndex workflows for RAG integrated with Argilla. Here are some examples of what you can build: AI Agents - Create intelligent systems that can reason Subclassing workflows Another great feature of workflows is their extensibility. Here we'll In this notebook, we demonstrate how to checkpoint Workflow runs via a WorkflowCheckpointer object. Introduction Considering the architecture below, it is evident how Agentic RAG creates an implementation which easily scales. ts. Aug 4, 2024 · The above example defines a workflow class OpenAIGenerator, where the generate function uses the @step decorator to mark this as a workflow step, the method signature defines what event messages it receives, and the return value defines what messages are published after the step is executed. The first is subclassing: workflows are just regular Python classes, which means you can subclass them to add new functionality. In this example, we'll demonstrate how to use the workflow functionality to achieve similar capabilities while allowing parallel execution of multiple events of the same type. Workflows A Workflow in LlamaIndex is an event-driven abstraction used to chain together several events. Introduction What is context augmentation? What are agents and workflows? How does LlamaIndex help build them? Use cases What kind of apps can you build with LlamaIndex? Who should use it? Getting started Get started in Python or TypeScript in just 5 lines of code! LlamaCloud Managed services for LlamaIndex including LlamaParse, the world's best document parser. This page highlights key examples to help you get started. There are two ways to start building with LlamaIndex in Python: Starter: llama-index. Community Get help and meet Examples In the navigation to the left, you will find many example notebooks, displaying the usage of various llama-index components and use-cases. Workflow s in LlamaIndex work by decorating function with a @step decorator. LlamaIndex Workflows is a new way to easily create agents that is built to move past linear workflows to more dynamic, decision-making processes. Concurrent execution of workflows In addition to looping and branching, workflows can run steps concurrently. Perfect for developers looking to build advanced conversational AI agent services. It acts as a bridge between large language models (LLMs) and external knowledge sources, enabling seamless retrieval-based AI workflows. Observability Debugging is essential to any application development, and Workflows provide you a number of ways to do that. A workflow in LlamaIndex provides a structured way to organize your code into sequential and manageable steps. AutoGen excels in conversational AI and code generation, while Microsoft’s offerings (Semantic Kernel and TaskWeaver) provide enterprise-grade solutions with strong architectural patterns. Jan 9, 2025 · Building Production-Ready Solutions Each of these examples is implemented as a detailed Jupyter notebook that you can run and adapt. STAGE-2: Uses the generated reasoning structure for the task to generate an answer. Once you're done, check out our Workflows component guide as a reference guide + more practical examples on building RAG/agents. Let’s get started. Mem0 offers two powerful ways to leverage our technology: our managed platform and our open Building Performant RAG Applications for Production Prototyping a RAG application is easy, but making it performant, robust, and scalable to a large knowledge corpus is hard. LlamaIndex Workflow makes asynchronous operations a first-class feature, enabling easy parallel execution and scalable workflows. Query Planning Workflow In this notebook, we'll walk through an example of a query planning workflow. Mar 6, 2025 · In this article, we’ve explored the power of event-driven workflows with LlamaIndex, building from simple branching patterns to sophisticated systems with RAG integration, human-in-the-loop capabilities, and multimodal processing. For an offical Workflow tutorial, visit the LlamaIndex documentation. Sep 5, 2024 · Now we have dovetailed the two mechanisms, producing llama-deploy , which combines the ease of building LlamaIndex Workflows with a simple, native deployment mechanism for them. You can check out our examples folder to see them all at once, or browse the pages in this section for some selected highlights. With llama_deploy, you can build any number of workflows in llama_index and then bring them into llama_deploy for deployment. This notebook works best with an open-source LLM, so we will use Ollama. The workflows demonstrate our approach to production-grade document processing: combining LlamaParse's advanced document understanding capabilities with LlamaCloud's robust retrieval and our agentic framework. Image by DALL-E-3 Recently, LlamaIndex introduced a new feature called Workflow in one of its versions, providing event-driven and logic decoupling capabilities for LLM applications. Use examples locally It may be useful to check out all the examples at once so you can try them out locally. IMPLEMENT: It gives reasoning structure for the task. Core Components LlamaDeploy consists of several core components acting as services in order to provide the environment where multi-agent applications can run and communicate with each other. In addition to basic components, further, in my workflow I also made use of: Aug 8, 2024 · Everything devs creating agentic systems need to understand about LlamaIndex Workflows versus graphs, and how to trace and evaluate workflows. Visualization The simplest form of debugging is visualization, which we've already used extensively in this tutorial. This guide contains a variety of tips and tricks to improve the performance of your RAG workflow. LlamaIndex provides a rich collection of examples demonstrating diverse use cases, integrations, and features. 0 emerges as the top choice for RAG-heavy applications with its clean event-driven architecture and automatic parallelization. Loops in workflows To create a loop, we'll take our example MyWorkflow from the previous tutorial and add one new custom event type. What is a Workflow ? Multi-Agents using Workflows . Learn how to leverage LlamaIndex’s Workflow functionality – and the ability to define cyclical events, cyclical workflows with LLMs – and LlamaIndex Workflows is a simple and lightweight engine for JavaScript and TypeScript apps. Human in the loop Tools can also be defined that get a human in the loop. In this notebook, we show how one can implement a human-in-the-loop pattern with Workflows. Let's visualize the simple workflow we just created: LlamaIndex (GPT Index) is a data framework for your LLM application. ) to call functions an use tools. Routing Query Transformations Sub Question Workflow for a ReAct Agent This notebook walks through setting up a Workflow to construct a ReAct agent from (mostly) scratch. A lot of modules (routing, query transformations, and more) are already agentic in nature in that they use LLMs for decision making. This notebook will assume that you have already either read the basic agent workflow notebook or the agent workflow documentation. FunctionAgent / AgentWorkflow Basic Introduction The AgentWorkflow is an orchestrator for running a system of one or more agents. Visualizing a workflow A great feature of workflows is the built-in visualizer, which we already installed. Community Get help and meet You can check out our examples folder to see them all at once, or browse the pages in this section for some selected highlights. But building a basic agent is simple: Set up Branches and loops A key feature of Workflows is their enablement of branching and looping logic, more simply and flexibly than graph-based approaches. Workflows offer several key benefits: Clear organization of code into discrete A Workflow in LlamaIndex is a lightweight, event-driven abstraction used to chain together several events. It remembers user preferences and traits and continuously updates over time, making it ideal for applications like customer support chatbots and AI assistants. You can visualize your workflow at any time by running the following code: This tutorial outlines the setup, code structure, and the implementation of a simple agentic workflow using Cerebras and LlamaIndex. Note that the workflow automatically validates itself using type annotations, so the type annotations on our steps are very helpful! For some Workflow applications, it may desirable and/or required to have humans involved in its execution. Apr 21, 2025 · In this article, you will learn how to leverage LlamaIndex Workflows with Elasticsearch to quickly build a self-filtering search application using LLM. To answer the query: In which city did the author found his first company, Viaweb?, we need to answer the following sub-questions sequentially: Who is the author that founded his first company, Viaweb? In which city did Paul Graham found his first company, Viaweb? As an example, the LlamaIndex is the leading framework for building LLM-powered agents over your data. The workflow is a dummy flow that simulates a report-writing agent: you give it a topic, it does research for you, and then presents that research. We'll look at two ways to do that. May 29, 2024 · 1. This sections details each and every component and will help you navigate the rest of the documentation. Contribute to run-llama/multi-agents-workflow development by creating an account on GitHub. May 5, 2024 · By leveraging these advanced workflows and the capabilities of LlamaIndex, you can create sophisticated LLM applications that cater to complex tasks and user interactions. Sep 10, 2024 · Users can customize the attributes of events. Workflow for a Function Calling Agent This notebook walks through setting up a Workflow to construct a function calling agent from scratch. Human in the Loop Workflow demo Want to walk through this code? Check out this video. Explore the following use cases to learn how to leverage LlamaIndex for your specific needs: Prompting - Learn advanced prompting techniques with LlamaIndex Question-Answering (RAG) - Build retrieval-augmented generation systems Chatbots - Create conversational AI applications Structured Data Extraction Agents In LlamaIndex, we define an "agent" as a specific system that uses an LLM, memory, and tools, to handle inputs from outside users. Sep 24, 2024 · This will pause the workflow and wait for the user input (See the human-in-the-loop example in this official Llamaindex notebook). Building an Tool Calling Agent Workflows can orchestrate calls to LlamaIndex Agents, which can use tools (like functions or other query engines). The multiverse of multi-agent systems is brimming… LlamaIndex uses prompts to build the index, do insertion, perform traversal during querying, and to synthesize the final answer. This tutorial is structured as a notebook to provide a hands-on, practical learning experience with Workflow, LlamaIndex's novel approach to design LLM applications, and managing the development process with MLflow. Why you should use workflows today Despite being at an early stage of development, LlamaIndex workflows already represent a step forward compared to query pipelines, extending their functionalities and adding more flexibility. LlamaDeploy (formerly llama-agents) is an async-first framework for deploying, scaling, and productionizing agentic multi-service systems based on workflows from llama_index. Mem0 Mem0 (pronounced “mem-zero”) enhances AI assistants and agents with an intelligent memory layer, enabling personalized AI interactions. This page walks through the three most common patterns, when to choose each one, and provides a minimal code sketch for every approach. You can take workflows written by others or built-ins from LlamaIndex and extend them to customize them to your needs. In addition to basic components, further, in my workflow I also made use of: Using Tools in LlamaIndex Quick Quiz 1 Using Agents in LlamaIndex Creating Agentic Workflows in LlamaIndex Quick Quiz 2 Conclusion Aug 1, 2024 · After each run_step call, the workflow can be inspected, examining any intermediate results or debug logs. ADAPT: Adapts selected reasoning modules to the task. We have a comprehensive, step-by-step guide to building agents in LlamaIndex. We'll call it LoopEvent but again it can have any arbitrary name. Each step processes an event and, if appropriate, emits new events. TS that we recommend to learn what agents are and how to build them for production. Basic workflow Getting started Workflows are built into LlamaIndex core, so to use them all you need is Multi-Agent Report Generation with AgentWorkflow In this notebook, we will explore how to use the AgentWorkflow class to create multi-agent systems. In today’s article, we’ll take a deep dive into this feature through a practical mini-project, exploring what’s new and still lacking. c. In another scenario, it may be required to have a human validate the initial output of a Workflow. This agent performs a web search to find relevant resources for a research topic, interacts with them, and extracts key metadata (e. We first outline some general techniques - they are loosely ordered in terms of most straightforward to most challenging Apr 21, 2025 · Explore LlamaIndex Workflow for building event-driven LLM architectures. LlamaIndex offers several notebook examples and video series that cover these concepts in more detail. We also show how we can view all of the checkpoints that are stored in this object and finally how we can use a checkpoint as the starting point of a new run. Agentic strategies You can build agents on top of your existing LlamaIndex RAG workflow to empower it with automated decision capabilities. Oct 11, 2024 · In the fast-evolving world of artificial intelligence, effective development tools and workflows can make all the difference. Learn how this tool optimizes multi-agent orchestration, enhancing efficiency and collaboration in complex scenarios. Self-Discover Workflow This notebooks shows how to implement SELF-DISCOVER. 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. If you're done building and want to deploy your workflow to production, check out our llama_deploy guide (repo). Customized: llama-index LongRAG Workflow This notebook shows how to implement LongRAG using LlamaIndex workflows. This prompting approach is based on "Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models". Let’s take a look at Alfred showing a LlamaIndex workflow for a RAG task. Introduction Query Pipelines in LlamaIndex help you to easily piece together and reuse RAG components in common workflows and define custom workflows as DAGs (Directed Acyclic Graph). Our out-of-the box workflows include our NLSQLTableQueryEngine and SQLTableRetrieverQueryEngine. As we'll see in our Workflows tutorial, the way Workflows work under the hood of AgentWorkflow is by running steps which both emit and receive events. This paper suggests that the response can be improved by asking the model to take a step back and reason about the context in a more abstract way. Reflection Workflow for Structured Outputs This notebook walks through setting up a Workflow to provide reliable structured outputs through retries and reflection on mistakes. To do this into a folder called my-new-project, run these commands: Jun 30, 2025 · LlamaIndex Workflows 1.