LlamaIndex — Deep Dive
The data framework for context-augmented LLM apps — an offline ingestion phase that builds an index, and an online query phase that reads it.
Seven moves — the inside of INGEST + QUERY
Everything on this page is one contract: INGEST builds the index offline, QUERY reads it online. Here is the inside of those two words:
Readers turn every source — PDF, API response, database row — into Documents: raw text plus metadata.
→ How it actually works
A node parser splits each Document into Nodes — the retrieval unit everything downstream scores and cites.
→ Node construction and metadata
Each Node becomes a vector, so questions match meaning instead of keywords.
→ Mental model
The StorageContext persists three stores — documents, index structure, vectors — so ingestion runs once, not per question.
→ LlamaIndex Architecture
The retriever embeds the question and pulls the top-k closest Nodes back out of the index.
→ The retrieval → postprocess → synthesis path
Postprocessors filter and reorder what came back — similarity cutoffs, rerankers — before any LLM sees it.
→ LlamaIndex Patterns
A response synthesizer answers from the surviving Nodes only, with citations back to the chunks it used.
→ Response synthesis modes
One rule underneath all seven: ingestion decides what query can find — a bad answer at question time usually traces back to a chunking or metadata decision made at index time.
What you’ll be able to explain
The two-phase contract: an offline ingestion pipeline that builds an index, an online query pipeline that reads it — and why every LlamaIndex abstraction is a named seam in one of the two.
Why the Node (not the Document) is the unit of retrieval, and what chunking and metadata decisions at ingestion time do to answer quality at query time.
The query path as retrieve → postprocess → synthesize, and which knob to turn when answers are wrong (retrieval) versus when they're ungrounded (synthesis).
How a query engine becomes an agent tool — the same index, wrapped so a reasoning loop can decide when to call it.
The red flags: the five-line demo shipped to production, chunking by character count, metadata thrown away at load.
Key terms, in plain words — 8 terms, tap any for a grounded answer
— one source file loaded as raw text, ready to be indexed.
— a bite-sized slice of a document — small enough to search precisely.
— a list of numbers capturing what a chunk means, so similar ideas land near each other.
— the searchable pile of all chunks, arranged by meaning rather than keywords.
— the lookup step: given a question, fetch the few most relevant chunks.
— retriever + language model: fetch the right chunks, then write an answer from ONLY those.
— a second, sharper judge that re-orders the fetched chunks so the best evidence comes first.
— the proofreader: every identifier in generated code must exist in the real source, or the excerpt is thrown away.
Companion guide
LlamaIndex Patterns — the ten that carry production RAG →
The same two-phase model as a ladder: the VectorStoreIndex baseline, each rung a specific answer to a specific way it broke, and the eval gate that makes the other nine safe to change.
Companion guide
LlamaIndex Architecture — the seams under the two-phase model →
The layer this page and the patterns ladder both stand on: nodes as the only data model, the StorageContext’s three stores, retrievers, postprocessors, synthesizers — and which seam to cut when a default stops fitting.
Companion guide
LlamaIndex Anti-Patterns — the ten ways teams get it wrong →
The ladder inverted: not what to build, but what gets built instead — the five-line demo shipped as a product, chunking by character count, metadata thrown away at load, retrieval tuned by vibes. Each demos beautifully, and each names the day it bites.
Go deeper
LlamaAgents & Workflows — build, serve, and deploy agent workflows with llama-index-workflows · RAG — the retrieval patterns these indexes exist to serve
The 30-Second Pitch
LlamaIndex is a data framework for building context-augmented LLM applications. It solves the core problem of connecting private, domain-specific data to large language models, which by themselves are limited to their pre-trained knowledge and lack access to your proprietary documents, databases, or APIs. Instead of fine-tuning a model—which is expensive and static—LlamaIndex provides tools to ingest, structure, index, and query your data, dynamically retrieving the most relevant context to include in an LLM prompt. A team would pick it over writing custom retrieval pipelines from scratch because it abstracts away the complexity of chunking, embedding, vector storage, and retrieval orchestration, offering a unified interface to work with diverse data sources and LLMs. It's the connective tissue between your data and your LLM.
Mental Model
The mental model for LlamaIndex is a two-phase contract: an offline ingestion phase that builds an index, and an online query phase that reads it. Almost every confusion ("why is retrieval slow?", "why are answers stale?") dissolves once you place the operation in the right phase. Ingestion = load → chunk → embed → store; it is batch, idempotent, and re-run when data or chunking changes. Query = embed the question → retrieve → (optionally route/rerank) → synthesize with an LLM; it is per-request and latency-bound.
LlamaIndex's abstractions (Node, Index, Retriever, QueryEngine, Tool) are just named seams in those two pipelines. Wrapping a QueryEngine as a Tool is the bridge to agents — at that point retrieval is one function call among many, and the synthesis step is governed by the same LLM serving latency/cost trade-offs as any other generation.
How It Actually Works
The mental model is a retrieval-augmented generation (RAG) orchestration framework. At its core, LlamaIndex manages the flow from raw data to an LLM answer. Think of it in layers:
- Data Ingestion & Structuring (Nodes/Indexes): Raw data (PDFs, Slack, SQL DBs, etc.) is loaded via
SimpleDirectoryReaderor source connectors. This data is broken into "Node" objects—chunks of text with metadata (like source file, relationships). These Nodes are the atomic units. - Indexing: This is where the magic happens. An "Index" is a data structure built from Nodes to enable efficient querying. The most common is the VectorStoreIndex:
- Each Node's text is converted into a vector embedding (using OpenAI, Cohere, or local models).
- These vectors are stored in a vector database (like Pinecone, Weaviate, or LlamaIndex's in-memory store).
- It also often builds a complementary summary index (a tree-like hierarchical index) for different query patterns.
- Querying: When you ask a question ("What were Q3 revenue figures?"), the query engine:
- Embeds your question into the same vector space.
- Performs a similarity search in the vector index to retrieve the top-k most relevant Nodes (context chunks).
- Synthesizes: It stuffs these retrieved contexts into a prompt template and sends it to the LLM (e.g., GPT-4) with instructions like "Answer based only on the following context."
- Advanced Orchestration: Beyond simple retrieval, LlamaIndex provides "Query Engines" and "Agents". A
SubQuestionQueryEnginecan break a complex query into sub-questions, query different indexes in parallel, and synthesize the final answer. AnOpenAIAgentcan use LlamaIndex tools (like a vector index query tool) within a ReAct loop, deciding when to retrieve data vs. use its internal knowledge.
Key Internals to Know:
ServiceContext: The legacy configuration hub (LLM, embedding model, chunk size, callback manager). It was removed in v0.10 and replaced by the globalSettingsobject, which you configure once (e.g.Settings.llm = ...,Settings.embed_model = ...) and override per-call where needed.StorageContext: Manages where index data (vectors, text, metadata) is stored (in-memory, Pinecone, Postgres).Response Synthesizers: Control how the LLM forms its answer (Refine,CompactAndRefine,TreeSummarize,SimpleSummarize).Refineis common: it iteratively incorporates each retrieved node, refining the answer.
Patterns You Should Know
1. Basic RAG Pipeline with Custom Chunking and Hybrid Search
This is the bread-and-butter. You need to show you can go beyond the default settings.
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, StorageContext
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core.retrievers import VectorIndexRetriever
from llama_index.core.query_engine import RetrieverQueryEngine
from llama_index.core.postprocessor import SimilarityPostprocessor
from llama_index.vector_stores.pinecone import PineconeVectorStore
import pinecone
documents = SimpleDirectoryReader("./data").load_data()
node_parser = SentenceSplitter(chunk_size=512, chunk_overlap=50) # Not the default 1024
nodes = node_parser.get_nodes_from_documents(documents)
# 2. Connect to a production vector store
pinecone.init(api_key=os.environ["PINECONE_API_KEY"], environment="us-west1-gcp")
pinecone_index = pinecone.Index("llamaindex-docs")
vector_store = PineconeVectorStore(pinecone_index=pinecone_index)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
# 3. Build Index with custom embedding model (from Hugging Face)
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
index = VectorStoreIndex(
nodes=nodes,
storage_context=storage_context,
embed_model=embed_model, # Override default OpenAI
)
# 4. Configure Retriever for Hybrid/Dense Search
retriever = VectorIndexRetriever(
index=index,
similarity_top_k=5,
vector_store_query_mode="hybrid", # If supported by vector store
alpha=0.7, # Weight for dense vs. keyword (0.5 = equal)
)
# 5. Build Query Engine with post-processing
query_engine = RetrieverQueryEngine.from_args(
retriever=retriever,
node_postprocessors=[SimilarityPostprocessor(similarity_cutoff=0.7)], # Filter low-score chunks
response_mode="compact_and_refine", # Efficient synthesis for many chunks
)
# 6. Query
response = query_engine.query("What is the company's policy on remote work?")
print(response)
2. Multi-Document Agent with Tool Calling
Shows you can build an interactive system where the LLM decides when to use retrieval.
import asyncio
from llama_index.core import StorageContext, Settings, load_index_from_storage
from llama_index.core.tools import QueryEngineTool, ToolMetadata
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
# Assume we persisted separate indexes for different data sources earlier
# (e.g. index.storage_context.persist(persist_dir="./storage/hr_index"))
hr_index = load_index_from_storage(
StorageContext.from_defaults(persist_dir="./storage/hr_index")
)
engineering_index = load_index_from_storage(
StorageContext.from_defaults(persist_dir="./storage/eng_index")
)
# Create Query Engines for each domain
hr_query_engine = hr_index.as_query_engine(similarity_top_k=3)
eng_query_engine = engineering_index.as_query_engine(similarity_top_k=3)
# Wrap them as Tools for an Agent
hr_tool = QueryEngineTool(
query_engine=hr_query_engine,
metadata=ToolMetadata(
name="hr_policy_search",
description="Useful for answering questions about company HR policies, benefits, and employee handbook.",
),
)
eng_tool = QueryEngineTool(
query_engine=eng_query_engine,
metadata=ToolMetadata(
name="engineering_docs_search",
description="Useful for answering technical questions about our codebase, APIs, and system architecture.",
),
)
# Configure the LLM globally via Settings (the replacement for the removed ServiceContext).
Settings.llm = OpenAI(model="gpt-4o")
# Modern agent API (LlamaIndex v0.12+): FunctionAgent / AgentWorkflow from
# llama_index.core.agent.workflow. The old ReActAgent.from_tools(...)/agent.chat(...)
# and OpenAIAgent are the legacy path.
agent = FunctionAgent(tools=[hr_tool, eng_tool])
# Agents are async — call them with await agent.run(...) (here driven via asyncio.run).
async def main():
response = await agent.run(
"Can engineers work remotely on Fridays, and what's the process for deploying a microservice?"
)
# Agent might: 1. Use hr_tool for remote work policy. 2. Use eng_tool for deployment process.
print(response)
asyncio.run(main())
3. Structured Data Extraction with Pydantic
Demonstrates moving beyond Q&A to data extraction, a common production use case.
from llama_index.core import VectorStoreIndex
from llama_index.core.query_engine import PandasQueryEngine
import pandas as pd
from pydantic import BaseModel
from typing import List
# Pattern A: Querying a CSV/DataFrame with natural language
df = pd.read_csv("revenue_data.csv")
query_engine = PandasQueryEngine(df=df, verbose=True)
response = query_engine.query("What was the total revenue in Q3 2023 for product line A?")
# LlamaIndex will generate and execute pandas code.
# Pattern B: Extracting structured information from unstructured text
class EmployeeRecord(BaseModel):
name: str
department: str
start_date: str
key_projects: List[str]
class EmployeeExtractor(BaseModel):
employees: List[EmployeeRecord]
from llama_index.program.openai import OpenAIPydanticProgram
# Load documents about company history
documents = SimpleDirectoryReader("./company_meeting_notes").load_data()
index = VectorStoreIndex.from_documents(documents)
# Create a program that uses the LLM + index to extract structured data
program = OpenAIPydanticProgram.from_defaults(
output_cls=EmployeeExtractor,
prompt_template_str=(
"Extract all employee records mentioned in the following context.\n"
"Context: {context_str}\n"
),
verbose=True,
)
# Use the index to get relevant context first
retriever = index.as_retriever(similarity_top_k=3)
nodes = retriever.retrieve("Employees and their roles")
context_str = "\n\n".join([n.node.text for n in nodes])
# Run extraction
extracted_data: EmployeeExtractor = program(context_str=context_str)
print(f"Extracted {len(extracted_data.employees)} employees.")
What Interviewers Actually Ask
Q: Explain the difference between a LlamaIndex Index and a QueryEngine. When would you use one directly over the other?
A: An Index (like VectorStoreIndex) is a data structure for organizing and storing your data nodes for efficient retrieval. A QueryEngine is the component that uses an index (or multiple) to execute a query, handling retrieval, post-processing, and response synthesis. You typically build an index once during data preparation. You then create a query engine from that index for querying. You'd use the index directly for lower-level operations like manual retrieval or index composition, but for end-user queries, you always go through a configured query engine.
Q: How does LlamaIndex handle long documents that exceed an LLM's context window?
A: It uses a multi-step process. First, the NodeParser splits documents into smaller chunks (nodes). During querying, the retriever fetches the top-k relevant chunks. The critical piece is the ResponseSynthesizer. The Refine synthesizer iteratively feeds chunks to the LLM, refining the answer. The CompactAndRefine synthesizer first packs as many chunks as possible into the context window, gets a partial answer, then continues with the remaining chunks. For summarization tasks, a TreeSummarize index can hierarchically summarize sections before combining them.
Q: You deploy a RAG system using LlamaIndex, and users report the answers are sometimes irrelevant or contain hallucinations. What's your debugging checklist?
A: First, I'd check retrieval quality: inspect the retrieved nodes for the failing queries (using callbacks or verbose=True). Are the right chunks being fetched? If not, adjust chunk size, try hybrid search, or improve embedding model. Second, check the synthesis prompt: ensure the prompt clearly instructs the LLM to "only use the provided context" and to say "I don't know" if the context is insufficient. Third, add post-processors: a SimilarityPostprocessor to filter out low-score chunks, and a LLMRerankPostprocessor to re-rank retrievals using the LLM for better precision. Finally, evaluate with a test set using metrics like Hit Rate and MRR.
Q: When would you not choose LlamaIndex for a project? What are its limitations? A: I'd avoid LlamaIndex for 1) Extremely simple RAG needs where a direct call to a vector DB's SDK and a hand-written prompt would suffice, as it adds abstraction overhead. 2) Heavily customized, non-retrieval workflows where its index/query engine paradigm doesn't fit. 3) Environments with minimal dependencies, as it's a sizable library. 4) When you need maximum performance/low-level control over every retrieval step; for that, you might build a lighter pipeline using the underlying vector DB and LLM SDKs directly. Its strength is developer productivity for standard RAG patterns, not being the leanest possible runtime.
Q: How would you integrate a LlamaIndex query pipeline into a production microservice?
A: I'd treat the index loading/query engine initialization as a singleton service or a warm container. The index would be persisted to a cloud vector store (like Pinecone) and object storage (for the index metadata). On service start, it loads the StorageContext from the cloud, which is fast. The query endpoint would accept a query string, pass it to the query engine, and return the response. I'd wrap it with logging, metrics (for latency, token usage), and circuit breakers. For scalability, I'd run multiple stateless service instances behind a load balancer, all connected to the same central vector database.
Q: Compare LlamaIndex to LangChain for building RAG applications. What are the key philosophical differences? A: LangChain is a "chains, agents, and tools" framework with a broader scope (including RAG). LlamaIndex is specifically focused on "data indexing and retrieval" for LLMs. Philosophically, LangChain offers more granular, Lego-like components, giving flexibility but requiring more assembly. LlamaIndex provides higher-level, more opinionated abstractions (Index, QueryEngine) that get you a working RAG system faster with less code. In practice, they can be used together—using LlamaIndex as a superior retrieval layer within a LangChain agent. For a pure RAG task, LlamaIndex is often more straightforward and performant.
Q: How does LlamaIndex handle data that changes frequently? What's the update strategy?
A: For frequent updates, you shouldn't rebuild the entire index. LlamaIndex supports incremental updates. You can load new documents, create nodes, and call index.insert_nodes(nodes). This will generate embeddings only for the new nodes and insert them into the vector store. For modified or deleted data, it's trickier. The common pattern is to use metadata filtering: add a doc_id and timestamp to nodes. On query, filter to the latest doc_id. For true deletions, you'd need to rely on your vector store's delete API (by node ID or metadata filter) and then call index.delete_nodes(). A full rebuild is still needed for major schema changes.
Q: You need to answer questions that require combining information from a SQL database and a set of PDF manuals. How would you architect this with LlamaIndex?
A: I'd create separate indices for each data source using specialized loaders (SQLDatabaseReader for the DB, SimpleDirectoryReader for PDFs). I'd then use a SubQuestionQueryEngine. When a complex query comes in, it uses an LLM to decompose it into sub-questions (e.g., "What's the product ID from the DB?", "What's the installation steps from the manual?"). It queries the appropriate index for each sub-question in parallel, then synthesizes a final answer from all partial answers. This is more robust than dumping both sources into one large index, as it respects the structure of the SQL data.
How It Connects to This Role's Stack
- Node.js/Backend: LlamaIndex (Python) would typically run in a separate, dedicated AI service within your microservices architecture. Your Node.js backend services would make REST or gRPC calls to this AI service for RAG capabilities. You'd use Docker to containerize the LlamaIndex service.
- AWS/Azure/GCP: You'd leverage cloud services for each component: S3/Azure Blob/GCS for storing raw documents and serialized index metadata. Pinecone (managed) or AWS OpenSearch/Azure Cognitive Search as the production vector database. Lambda/Cloud Functions could run lightweight indexing tasks triggered by new data uploads.
- CI/CD: Your pipeline would include testing for the LlamaIndex application—not just unit tests, but retrieval evaluation tests (checking that key queries return correct excerpts). Version control would include index configuration schemas and prompt templates.
- Docker/Kubernetes: The LlamaIndex query service would be packaged as a Docker image. In Kubernetes, you'd deploy it as a Deployment with resource limits (it can be memory-intensive during indexing). You might have a separate CronJob or Job for running periodic index updates.
- Microservices: The LlamaIndex system is a prime example of a specialized AI microservice. It exposes a clean API (e.g.,
/query,/ingest) to other services, encapsulating the complexity of embeddings, retrieval, and LLM interaction.
Runtime Internals
The two-phase model hides where production systems actually break.
Node construction and metadata
A Node is not just a text chunk — it carries metadata, relationships (prev/next/source), and an embedding. Retrieval quality is capped at ingestion: if chunking splits a table from its caption, no reranker recovers it. The runtime lever is the node parser (sentence-window, hierarchical) plus what metadata you attach for later filtering.
The retrieval → postprocess → synthesis path
A QueryEngine is a pipeline, not a function: retrieve top-k, run node postprocessors (rerank, similarity cutoff, metadata filter), then a response synthesizer composes the answer. Each stage is a precision/recall/cost dial; the most common production fix is adding a reranker, not increasing k.
Response synthesis modes
For contexts that exceed the window, LlamaIndex uses refine/compact/tree_summarize — multi-call strategies that trade latency and token cost for completeness. compact packs nodes to minimize calls; tree_summarize recursively merges. Picking the mode is a direct cost lever, and its quality must be measured with evaluation fundamentals, not eyeballed.
Agentic routing over multiple indexes
Wrapping QueryEngines as Tools lets an agent pick which index to hit. The runtime risk shifts from retrieval quality to routing quality: a wrong tool choice returns a confident answer from the wrong corpus. This makes router evaluation as important as retrieval evaluation.
Red Flags to Avoid
- "LlamaIndex is a vector database." No, it's a framework that uses vector databases. It has a simple in-memory one, but for production you plug in Pinecone, Weaviate, etc.
- "You just call
VectorStoreIndex.from_documents()and it's production-ready." This ignores critical production concerns: chunking strategy, embedding model choice, hybrid search, post-processing, logging, and evaluation. - Confusing
ResponseSynthesizermodes. Don't say you always userefine. Explain the trade-offs:compact_and_refineis more cost-effective for many chunks,simple_summarizeis fast but may lose detail. - Not mentioning the cost/performance trade-offs of synthesis. Multi-call modes like
refineandtree_summarizeissue one LLM call per node (or per merge step), so token cost and latency scale with the number of retrieved chunks. Always tie the synthesis-mode choice back to a measured budget, not a default.
The ten patterns
Everything above is the mental model. The ladder below is what you actually build with it — each rung with its code on LlamaIndex Patterns.
1. The Baseline: VectorStoreIndex + Query Engine
You want a corpus queryable in an afternoon — and a baseline number every later retrieval change has to beat.
2. Ingestion Pipeline: Caching, Dedup, Incremental Sync
The same corpus gets ingested more than once and re-runs need to cost near-zero: content-hash caching, docstore-backed upserts, incremental sync.
3. Chunking & Node Parsing
Retrieval quality is bad and the embeddings aren't the problem — the unit of text you indexed is.
4. Metadata Filtering & Auto-Retrieval
Your corpus is partitioned by something the embedding can't see — tenant, year, service, doc type — and similarity keeps dragging in the wrong slice.
5. Hybrid Search + Reranking
Embeddings alone miss exact terms — IDs, error codes, product names — and you can afford one extra scoring pass to buy precision back.
6. Query Transformations: HyDE, Multi-Step, Sub-Question
Retrieval fails because the question is worded wrong or asks three things at once — not because the index is bad.
7. Routing: Picking the Right Index
One corpus has to answer structurally different question types — summarize-the-whole-thing vs find-me-this-fact — and a single retriever is wrong for at least one.
8. Agentic RAG: The Query Engine as a Tool
One retrieval pass isn't enough — the question spans several corpora, or needs a follow-up query the user never wrote.
9. Structured Extraction Over Retrieved Context
The consumer of your retrieval step is code, not a human — you need typed records out of retrieved prose, with validation as the reliability contract.
10. Evaluation & Observability: The Gate
You need to change a retriever, prompt, or model and know — before you ship — whether you made the system better or just different.
Recall check
Answer before revealing — the effort of pulling it back is the point. No peeking.
LlamaIndex's mental model is a two-phase contract. Name the phases, and what one produces for the other.
Show answer
An offline INGEST phase (load → chunk → embed → store) builds an index; an online QUERY phase (retrieve → rank → synthesize) reads it. The index is the handoff — every abstraction in the framework is a named seam in one of the two pipelines.
From the research: Retrieval practice (the testing effect) — Roediger & Karpicke — Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention (2006)
What's the difference between a Document and a Node — and which one does retrieval actually operate on?
Show answer
A Document is one loaded source (raw text plus metadata); a node parser splits it into Nodes, the chunks that get embedded. Retrieval scores, returns, and cites Nodes — so chunking and metadata decisions at ingestion decide what CAN be retrieved later.
From the research: Retrieval practice (the testing effect) — Roediger & Karpicke — Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention (2006)
Answers are coming back wrong. The query path has three stages — name them, and which you inspect first.
Show answer
Retrieve → postprocess (filter/rerank) → synthesize. Inspect retrieval first: if the right Nodes never came back, no synthesizer can fix it — tune chunking, top-k, filters, or hybrid search before touching prompts.
From the research: Retrieval practice (the testing effect) — Roediger & Karpicke — Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention (2006)
How does an index become something an agent can use?
Show answer
Wrap its query engine as a tool (QueryEngineTool) with a description saying when to use it. The agent's reasoning loop then decides per question whether to call it — same index, now one callable option among several.
From the research: Retrieval practice (the testing effect) — Roediger & Karpicke — Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention (2006)
Why does the response synthesizer have modes, and when does the default bite?
Show answer
The modes trade LLM calls against context size: compact stuffs the retrieved Nodes into as few calls as possible, refine iterates chunk by chunk, tree_summarize builds a summary tree. The default bites when many/long Nodes overflow what one call can honestly ground — summarization-shaped questions want tree_summarize, not compact.
From the research: Retrieval practice (the testing effect) — Roediger & Karpicke — Test-Enhanced Learning: Taking Memory Tests Improves Long-Term Retention (2006)
Flashcards for this topic
Glossary — the domain terms, grounded in the code
33terms, each defined from this subsystem’s real source.
agent
In LlamaIndex, an agent is a piece of software that semi-autonomously performs tasks by combining an LLM, memory, and tools, orchestrated in a reasoning loop that decides which tool to use next, and it handles inputs from outside users.
Memory hook The agent is a reasoning loop that decides which tool to use next and runs it until the task is done.
agentic application
An agentic application in LlamaIndex is any system that uses an LLM to make decisions, take actions, and/or interact with the world, typically augmented with tools, memory, and dynamic prompts, and may incorporate prompt chaining, routing, parallelism, orchestration, or reflection.
Memory hook Agentic application is the orchestrator that uses LLMs and tools to direct actions.
AgentWorkflow
In LlamaIndex, AgentWorkflow is a class that enables combining multiple agents into a system where each agent hands off control to coordinate task completion.
Memory hook The AgentWorkflow is the handoff coordinator that passes control between agents to complete multi-agent tasks.
FunctionAgent
FunctionAgent is a type of agent in LlamaIndex that uses an LLM provider's function or tool calling capabilities to execute tools, as described in the documentation for creating agents.
Memory hook FunctionAgent is the direct caller that activates tools using the LLM's own function-calling, not custom prompts.
workflow
In LlamaIndex, a workflow is an event-driven, step-based abstraction that controls application execution flow by dividing it into steps triggered by events, where each step emits further events to activate subsequent steps, enabling arbitrarily complex flows such as loops and branching.
Memory hook Workflow is the event-driven conductor that orchestrates steps and LLM calls in a looping sequence.
step
In LlamaIndex, a step is a method decorated with the `@step` decorator that forms a unit of execution within a Workflow, triggered by an Event and capable of emitting further Events to activate subsequent steps.
Memory hook A step is an event-triggered worker that receives one event and emits another to keep the workflow moving.
event
In LlamaIndex, an event is a user-defined Pydantic object that triggers a workflow step, carries data between steps, and can be emitted to activate subsequent steps.
Memory hook Event is the data-carrying trigger that activates the next step in a workflow.
StartEvent / StopEvent
In LlamaIndex, the StartEvent is a special framework-provided event that marks the entry point of a workflow, holding arbitrary attributes passed via the .run() method, while the StopEvent designates final steps and, upon being returned, immediately terminates the workflow and returns the value passed in its result parameter.
Memory hook StartEvent is the green light that launches the run; StopEvent is the red light that halts and hands back the result.
Context (workflow)
In LlamaIndex workflows, a Context object is passed between steps to store and share state across them, eliminating the need for steps to pass every value explicitly through events.
Memory hook Context is the shared sticky note that steps pass around, storing state so they don’t clutter events with every detail.
tool
A tool in LlamaIndex is a generic interface that implements a `__call__` method and returns metadata such as name, description, and function schema, serving as the core abstraction for building agentic systems by defining actions that agents can select and execute.
Memory hook A tool is an agent's API endpoint—a named, described function it selects and calls to act.
FunctionTool
FunctionTool in LlamaIndex is a tool that converts any user-defined function into a Tool, automatically inferring the function schema or allowing customization of various aspects.
Memory hook FunctionTool is the automatic converter that turns any Python function into an agent tool by inferring its schema.
QueryEngineTool
A QueryEngineTool is a type of Tool that wraps an existing query engine, and because agent abstractions inherit from BaseQueryEngine, these tools can also wrap other agents.
Memory hook QueryEngineTool wraps a query engine into a tool so agents can query your data.
ToolSpec
A ToolSpec is a community-contributed specification that defines one or more tools around a single service, such as Gmail, and implements a `to_tool_list` method to provide pre-defined tool collections for common APIs.
Memory hook ToolSpec bundles community-contributed tools for a single service into one ready-to-use collection.
memory
In LlamaIndex, memory is a core component of agents that stores chat history and is managed by default using the `ChatMemoryBuffer` class, which can be customized separately and passed to an agent.
Memory hook Memory is the agent's chat logbook, storing every message and tool result to guide its next decisions.
query engine
A query engine is a generic interface that takes a natural language query and returns a rich response, most often built on one or more indexes via retrievers.
Memory hook Query engine is the single-query gatekeeper: it takes a question, retrieves context, and returns a rich answer.
chat engine
A chat engine is a high-level interface for having a conversation with your data through multiple back-and-forth exchanges, functioning as a stateful counterpart to a query engine by maintaining conversation history to consider previous context in responses.
Memory hook Chat engine is the stateful chat partner that remembers past exchanges so you can ask follow-up questions.
retriever
A retriever is a component responsible for fetching the most relevant context from an index given a user query or chat message, serving as a key building block in query engines and chat engines.
Memory hook The retriever is the librarian that fetches the most relevant nodes from the index based on your query.
router
A router determines which retriever will be used to retrieve relevant context, using a selector based on each candidate's metadata and the query.
Memory hook The router is a dispatcher that routes each query to the best retriever by checking metadata.
node postprocessor
A node postprocessor takes in a set of retrieved nodes and applies transformations, filtering, or re‑ranking logic to them, and it runs after nodes are retrieved from a retriever and before the response synthesizer generates a response.
Memory hook The node postprocessor is the quality-control inspector that re-ranks or filters retrieved nodes before the response synthesizer gets them.
response synthesizer
A response synthesizer generates a response from an LLM by using a user query and a given set of text chunks, and it is used after nodes are retrieved from a retriever and after any node‑postprocessors are run.
Memory hook The response synthesizer is the assembly line that takes retrieved text chunks and outputs your final answer.
response mode
A response mode is a setting passed as a kwarg to a response synthesizer that determines the strategy used to generate a response from an LLM using a user query and a given set of text chunks, with options such as refine, compact, tree_summarize, simple_summarize, no_text, and accumulate.
Memory hook The response mode is the assembly line that defines how text chunks are processed into the final answer.
index
An index in LlamaIndex is a data structure constructed from documents that stores information in node objects and enables quick retrieval of relevant context for user queries, serving as the core foundation for retrieval-augmented generation (RAG) use‑cases and allowing the creation of query engines and chat engines.
Memory hook The index is the filing cabinet that slices your documents into searchable chunks and tags each with a vector number.
VectorStoreIndex
A VectorStoreIndex is a type of index that splits documents into nodes, computes a vector embedding for each node, and stores them so that, at query time, the nodes most similar to the query embedding can be retrieved, making it the most widely used index type and the ideal starting point for most implementations.
Memory hook VectorStoreIndex is the librarian that retrieves the most relevant chunks by comparing their vector embeddings.
SummaryIndex
The SummaryIndex is a simple index that stores nodes as a sequential list and, by default, returns all nodes for a query, making it useful for summarization over a whole document.
Memory hook The SummaryIndex is the firehose index that returns all nodes for full-document summarization.
document
In LlamaIndex, a Document is a general container for any data source—such as PDFs, API responses, or database queries—that preserves text content along with metadata and relationship attributes, and serves as the foundational input for indexing and retrieval-augmented generation workflows.
Memory hook Document is the original container that carries raw data and metadata before being chunked into nodes.
node
A Node is the atomic unit of data in LlamaIndex, representing a discrete “chunk” from a source Document (such as a text segment or image) that inherits the Document’s metadata and includes its own metadata and relationship information linking to other nodes.
Memory hook Node, the atomic data chunk, inherits its document's metadata and links to sibling nodes.
node parser
A node parser is a transformation that takes a list of Documents and chunks them into Node objects, splitting text on sentence boundaries while respecting a configured chunk size and overlap.
Memory hook The node parser is the chunker that splits documents into node-sized pieces.
embedding
In LlamaIndex, an embedding is a numerical representation of data, typically computed for each node and stored in a vector store, so that at query time the system converts the query into an embedding and retrieves nodes whose embeddings are numerically similar, enabling relevance filtering.
Memory hook Embeddings are the numeric fingerprints that convert your query into a vector for finding similar data.
vector store
A vector store in LlamaIndex is a specialized database that stores vector embeddings, and at query time it finds data numerically similar to the embedding of the query. It serves as the storage backend for indexes like VectorStoreIndex, which compute and store embeddings for each node.
Memory hook The vector store is the specialized database that stores embeddings and retrieves numerically similar context for queries.
data connector (Reader)
A data connector, often called a Reader, ingests data from different data sources and formats into Documents and Nodes.
Memory hook The data connector is the translator that ingests data from any source, turning it into Documents and Nodes.
ingestion pipeline
An ingestion pipeline in LlamaIndex applies a series of transformations to input data, producing nodes that are either returned or inserted into a vector database, with caching of each node‑transformation pair to speed up subsequent runs.
Memory hook The ingestion pipeline is a smart assembly line that caches each transformation to avoid re-processing the same data.
transformation
In LlamaIndex, a transformation is an operation applied to input data within an IngestionPipeline that produces nodes, and common examples include node parsers, text splitters, metadata extractors, and embedding models; each node‑transformation pair is cached to speed up subsequent runs.
From developers.llamaindex.ai/python/framework/module_guides/loading/ingestion_pipeline/RAG
RAG in LlamaIndex is a core technique for building data-backed LLM applications that solves the problem of LLMs not being trained on your data by loading, indexing, and storing your data, then at query time filtering it down to the most relevant context and sending that context along with the user query to an LLM to generate a response.
Memory hook RAG is your data's librarian, indexing it to retrieve only the context relevant to each query.