LlamaIndex

Framework · Last verified 2026-09-30

TL;DR

LlamaIndex is an open-source Python framework from the company LlamaIndex for building RAG and agent applications over your own data. Its AgentWorkflow lets agents hand off to each other on top of event-driven Workflows with serializable state. The company now focuses on its paid LlamaParse platform. It suits document-heavy agent projects in Python.

Key facts

LlamaIndex key facts. Data as of 2026-09-30.
Type Framework
Languages / SDKs Python
License MIT
Pricing model Open core
Orchestration pattern Handoff
GitHub stars 52,368 (as of 2026-09-30)
GitHub forks 8,253
Last push 2026-09-29
Latest release v0.14.25
Repository run-llama/llama_index
Website developers.llamaindex.ai
Documentation developers.llamaindex.ai
Last verified 2026-09-30

Key features

  • AgentWorkflow runs a set of FunctionAgent or ReActAgent instances, starting at a root agent and letting agents hand off via can_handoff_to. (source)
  • Orchestrator pattern: a top-level agent calls sub-agents exposed to it as tools; a custom-planner pattern is also documented. (source)
  • Workflows: event-driven steps that emit and receive events, the layer AgentWorkflow is built on. (source)
  • Workflow Context holds state within and between runs and serializes with to_dict / from_dict. (source)
  • Memory class combining a token-limited short-term queue with optional long-term memory blocks. (source)
  • Human input through InputRequiredEvent and HumanResponseEvent with ctx.wait_for_event inside tools. (source)
  • Use tools from existing MCP servers (llama-index-tools-mcp) and serve LlamaIndex workflows as MCP servers. (source)
  • llama-index-protocols-ag-ui package creates a FastAPI router that speaks the AG-UI protocol to frontends such as CopilotKit. (source)

Architecture and orchestration pattern

Pattern: Handoff

The base layer is Workflows: steps are async functions that receive and emit typed events, and a run is the event flow between them. Agents (FunctionAgent, ReActAgent) and AgentWorkflow are pre-built workflows that handle tool calling and streaming.

For multiple agents, AgentWorkflow takes a list of agents and a root agent. The active agent calls tools and may hand control to another agent listed in its can_handoff_to, until one returns a final answer or hands back to the user. The docs also describe an orchestrator agent that calls sub-agents as tools, and a custom planner written by hand.

Run state lives in a Context object that can carry values between runs and be serialized to JSON or pickle for later resumption. Conversation memory is a Memory object: recent messages up to a token limit, with older messages flushed into optional long-term memory blocks. Retrieval over documents (indexes, retrievers, query engines) is the framework's original core and can be exposed to agents as tools.

Human in the loop

A tool can pause for a person by calling ctx.wait_for_event(HumanResponseEvent, waiter_event=InputRequiredEvent(...)). The caller sees the InputRequiredEvent in the event stream, collects input (the docs use keyboard input), and sends a HumanResponseEvent back with handler.ctx.send_event; the tool then continues or aborts based on the reply. In AgentWorkflow the active agent can also return control to the user. Because Context serializes, a paused run's state can be saved and restored.

Protocols

MCP, A2A and AG-UI support for LlamaIndex. See the full matrix.
ProtocolSupportNote
MCP Yes evidence
checked 2026-09-30
Client: BasicMCPClient and McpToolSpec (llama-index-tools-mcp) turn MCP server tools into LlamaIndex tools over SSE, Streamable HTTP or stdio; the MCP module guide also covers serving workflows as MCP servers.
A2A Unknown
checked 2026-09-30
Searched README, developers.llamaindex.ai llms.txt and docs grep API, GitHub code search in run-llama/llama_index (hits were unrelated strings) and issues for a2a / agent2agent; nothing official found.
AG-UI Yes evidence
checked 2026-09-30
Server adapter: the first-party llama-index-protocols-ag-ui package exposes a workflow agent through an AG-UI FastAPI router; the AG-UI README also lists LlamaIndex as 1st-party.

Best for

  • Agents that answer from large document collections using LlamaIndex retrieval and indexing.
  • Multi-agent flows where specialists hand work to each other in a defined order.
  • Backends for chat UIs that speak AG-UI, such as CopilotKit frontends.
  • Local setups with Ollama models and Hugging Face embeddings.

Not for

  • TypeScript projects: LlamaIndex.TS is deprecated and archived.
  • Teams that want a framework whose vendor's primary focus is the open-source agent toolkit.
  • Supervisor-style orchestration with built-in approval gates on every tool call.

Quickstart

pip install llama-index

Install not yet verified by this site. What this means

import asyncio
from llama_index.core.agent.workflow import AgentWorkflow, FunctionAgent
from llama_index.llms.openai import OpenAI

llm = OpenAI(model="gpt-4o-mini")
def word_count(text: str) -> int:
    """Count the words in a piece of text."""
    return len(text.split())

drafter = FunctionAgent(name="Drafter", description="Writes a first draft.", llm=llm, tools=[],
                        system_prompt="Write a two-sentence draft, then hand off to Editor.", can_handoff_to=["Editor"])
editor = FunctionAgent(name="Editor", description="Tightens drafts.", llm=llm, tools=[word_count],
                       system_prompt="Shorten the draft and report its word count.")

workflow = AgentWorkflow(agents=[drafter, editor], root_agent="Drafter")

async def main():
    print(await workflow.run(user_msg="Announce our new office hours: Mondays 9-11."))

asyncio.run(main())

Common pitfalls

  • pip install llama-index is a starter bundle (core, OpenAI LLM and embeddings, file readers); other providers need separate integration packages such as llama-index-llms-ollama.
  • The OpenAI defaults need OPENAI_API_KEY; the installation page says the default models are gpt-3.5-turbo and text-embedding-ada-002 unless you pass a model explicitly.
  • Imports containing core come from llama-index-core; imports without it come from integration packages that must be installed separately.
  • MCP tools need pip install llama-index-tools-mcp; AG-UI needs llama-index-protocols-ag-ui.

Official quickstart

Pros

  • Large integration catalog (the README counts over 300 packages) installed piecemeal on top of llama-index-core. (source)
  • Three multi-agent patterns are documented with trade-offs: handoff workflow, orchestrator with agents as tools, and custom planner. (source)
  • Serializable Context lets a run's state be stored and restored later. (source)
  • MCP in both directions: consume MCP servers as tools and publish workflows as MCP servers. (source)
  • First-party AG-UI adapter for connecting agents to AG-UI frontends. (source)

Cons

  • The README says the company's primary focus has shifted to LlamaParse; the framework remains available as an open toolkit. (source)
  • The TypeScript port, LlamaIndex.TS, is deprecated, no longer maintained and archived. (source)
  • An open bug reports ReActAgent handoffs leaving stale reasoning in ctx.store that leaks into the next turn. (source)
  • An open bug reports the agent's state prompt going stale after tools update workflow state. (source)
  • The installation docs list gpt-3.5-turbo and text-embedding-ada-002 as default models, so models should be set explicitly. (source)

Alternatives

FAQ

Does LlamaIndex support MCP?

Yes. The llama-index-tools-mcp package loads tools from MCP servers (SSE, Streamable HTTP or stdio), and the docs show converting LlamaIndex workflows into MCP servers.

Does LlamaIndex support AG-UI?

Yes. The first-party llama-index-protocols-ag-ui package creates a FastAPI router that speaks AG-UI, and the AG-UI project lists LlamaIndex as a 1st-party integration. A2A support was not found.

Is LlamaIndex free?

The framework is MIT-licensed. The company's paid product is LlamaParse (document parsing, extraction and indexing), priced separately on its pricing page.

How do LlamaIndex agents hand off work?

In AgentWorkflow, each FunctionAgent lists the agents it may hand off to in can_handoff_to; the workflow starts at the root agent and switches when an agent hands off.

Is there a TypeScript version?

LlamaIndex.TS existed, but its repository now carries a deprecation notice and is archived, so this record lists Python only.

Sources

Unknown fields: protocols.a2a is unknown: README, developers.llamaindex.ai llms.txt and its grep API, GitHub code search in run-llama/llama_index (matches were unrelated strings) and issue search found no official A2A support.