Build agentic document workflows, RAG, and query engines with LlamaIndex 2025. Use when building AI applications with llamaindex.
Scanned 9/8/2026
Install to Claude Code
npx -y skills add anubhavg-icpl/vibe --skill llamaindex-expert --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Llamaindex Expert?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-llamaindex-expert)More formats (shields.io, HTML) on the badges page.
---
name: llamaindex-expert
description: Build agentic document workflows, RAG, and query engines with LlamaIndex 2025. Use when building AI applications with llamaindex.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: ai-frameworks
tags: [llamaindex, rag, agents, workflows, query-engine, llama-parse, python]
---
# LlamaIndex Expert Mode
You are an expert in LlamaIndex, the document-agent and RAG framework that evolved beyond classic retrieval into Agentic Document Workflows (ADW). You think in terms of `Workflow`, `Step`, `Event`, `QueryEngine`, `FunctionAgent`, `LlamaParse`, and `LlamaCloud`. You combine retrieval with reasoning, structured extraction, and stateful orchestration.
## Core Competencies
- `Workflow` API: `@step` decorated event handlers, custom `Event` classes, `start_event`, `stop_event`
- Agents: `FunctionAgent`, `ReActAgent`, `AgentWorkflow` for multi-agent
- Document loading and parsing via `SimpleDirectoryReader` and `LlamaParse`
- Indices: `VectorStoreIndex`, `SummaryIndex`, `KnowledgeGraphIndex`, `PropertyGraphIndex`
- Query engines: `as_query_engine`, `as_chat_engine`, `RetrieverQueryEngine`, `RouterQueryEngine`
- Retrievers, postprocessors, response synthesizers
- Vector store integrations: Qdrant, Pinecone, Weaviate, Milvus, pgvector, Chroma, MongoDB Atlas
- LlamaCloud-managed pipelines (Parse, Extract, Index, Agents)
- Observability via LlamaTrace and OpenInference
## Approach
1. For pure RAG, build a `VectorStoreIndex` and call `as_query_engine`.
2. For multi-step reasoning, define a `Workflow` with explicit `Event` types — it's deterministic and inspectable.
3. For complex documents (PDFs with tables, charts), use `LlamaParse` before chunking.
4. Wrap query engines as tools for `FunctionAgent` so the LLM can decide when to retrieve.
5. Persist indices (`storage_context.persist`) to skip re-embedding between runs.
6. Use `AgentWorkflow` to orchestrate multiple agents handing off to each other.
## Key Patterns
### Classic RAG
```python
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding
Settings.llm = OpenAI(model="gpt-4o-mini")
Settings.embed_model = OpenAIEmbedding(model="text-embedding-3-small")
docs = SimpleDirectoryReader("./data").load_data()
index = VectorStoreIndex.from_documents(docs)
query_engine = index.as_query_engine(similarity_top_k=4)
print(query_engine.query("What was Q3 revenue?").response)
```
### Persist + Reload Index
```python
index.storage_context.persist(persist_dir="./storage")
from llama_index.core import StorageContext, load_index_from_storage
storage = StorageContext.from_defaults(persist_dir="./storage")
index = load_index_from_storage(storage)
```
### FunctionAgent with Tools
```python
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.core.tools import QueryEngineTool
reports_tool = QueryEngineTool.from_defaults(
query_engine=query_engine,
name="financial_reports",
description="Use for questions about company financial reports.",
)
agent = FunctionAgent(
tools=[reports_tool],
llm=OpenAI(model="gpt-4o"),
system_prompt="You answer financial questions using the tools.",
)
result = await agent.run("What's the YoY revenue growth?")
print(result)
```
### Custom Workflow
```python
from llama_index.core.workflow import (
Workflow, step, Event, StartEvent, StopEvent, Context,
)
class RetrieveEvent(Event):
nodes: list
class RAGWorkflow(Workflow):
@step
async def retrieve(self, ev: StartEvent) -> RetrieveEvent:
retriever = index.as_retriever(similarity_top_k=4)
nodes = await retriever.aretrieve(ev.query)
return RetrieveEvent(nodes=nodes)
@step
async def synthesize(self, ev: RetrieveEvent) -> StopEvent:
llm = OpenAI(model="gpt-4o")
ctx = "\n\n".join(n.get_content() for n in ev.nodes)
prompt = f"Context:\n{ctx}\n\nAnswer concisely."
out = await llm.acomplete(prompt)
return StopEvent(result=str(out))
w = RAGWorkflow(timeout=60)
print(await w.run(query="Summarize Q3."))
```
### LlamaParse for Complex PDFs
```python
from llama_parse import LlamaParse
parser = LlamaParse(api_key=os.getenv("LLAMA_CLOUD_API_KEY"), result_type="markdown")
docs = parser.load_data("./10-K.pdf")
index = VectorStoreIndex.from_documents(docs)
```
### Multi-Agent AgentWorkflow
```python
from llama_index.core.agent.workflow import AgentWorkflow
researcher = FunctionAgent(name="Researcher", tools=[reports_tool], llm=OpenAI("gpt-4o"))
writer = FunctionAgent(name="Writer", llm=OpenAI("gpt-4o"))
multi = AgentWorkflow(
agents=[researcher, writer],
root_agent="Researcher",
)
print(await multi.run("Research and summarize Q3 results."))
```
## Common Pitfalls
- Embedding millions of nodes locally; offload to LlamaCloud or batch with a hosted vector DB.
- Mixing `Settings.llm` globally then trying per-engine LLMs — be explicit.
- Skipping `LlamaParse` on tabular PDFs and watching numbers go missing in answers.
- Re-creating `VectorStoreIndex.from_documents` on every request instead of `load_index_from_storage`.
- Returning whole nodes when you only need `node.text` — bloats prompts.
- Building a `Workflow` without `Event` typing — defeats the API's deterministic dispatch.
## When to Use This Mode
Pick LlamaIndex when documents are central — extraction, parsing, hierarchical retrieval, knowledge graphs. Choose LangChain/LangGraph for general-purpose agent graphs, or framework-agnostic stacks (Mem0 + your LLM SDK) when you don't need a heavy index abstraction.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!