PageIndex is a retrieval engine for long documents that replaces the vector index with a hierarchical tree index and has an LLM reason its way through it. Retrieval happens in two steps: generate a tree-structure index for each document, then search that tree agentically. There is no chunking and no vector database, and results are traceable to explicit section references rather than to similarity scores.
The argument the project makes for that design is that similarity and relevance differ: on documents that need contextual understanding, domain knowledge, and multi-step reasoning, similarity search returns material that resembles the query and misses material that answers it. Named target document types include financial reports, legal documents, regulatory filings, technical manuals, medical literature, and academic textbooks.
The Python SDK runs in two modes behind one client. Local mode indexes, retrieves, and chats on your own machine with your own model key; cloud mode moves indexing and storage to a hosted service while chat still runs on your model. Two models are configured separately: the index model only summarizes and refines a structure extracted from the document layout, so a basic model suffices, while the chat model searches the tree and benefits from the strongest model you can afford.
Published measurements cover cost as well as accuracy. Local indexing runs at about $0.001 per page with a small index model, and benchmark documents from 9 to 1,098 pages indexed in roughly 13 seconds to 4.5 minutes. Compared with passing the whole PDF to the model on every question, retrieval costs 2.1 times less at 52 pages and 16.6 times less at 420, and at 805 pages the document exceeds the context window entirely. On the FinanceBench financial-document question-answering benchmark the project reports 98.7% accuracy against 50% for vector-based RAG, and a separate open benchmark measures the quickstart configuration on 62 lookup questions across 34 PDFs.
| Capability | Local | Cloud |
|---|---|---|
| Best for | text-heavy PDFs and local workflows | scanned, image-heavy, and large collections |
| Indexing | runs locally | hosted, with production OCR and image understanding |
| Storage | local | managed |
| Citations | page-level | line-level |
| Multi-document scale | manual | file-level tree indexing over a corpus |
| MCP server | not available | available |
Features
- Tree index: a hierarchical structure per document built from its natural sections, not fixed-size chunks
- Reasoning retrieval: an LLM searches the tree agentically instead of ranking embeddings
- No vector database: retrieval needs neither embeddings nor a separate store
- Traceable answers: results point at explicit document references rather than opaque matches
- Local or cloud: one client indexes on your machine or against the hosted service
- Split model roles: a cheap index model and a stronger chat model, configured independently
- Agent integration: PageIndex tools drop into the OpenAI Agents SDK, the Claude Agent SDK, or another framework
- Cloud extras: OCR, image understanding, line-level citations, managed storage, and an MCP server
- Corpus-scale indexing: a file-level tree layer that reasons across an entire document collection
Built with this
Integrates with
LangChain
Framework for building LLM applications and agents from interoperable components and a large integrations library
LiteLLM
Open-source AI gateway exposing 100+ LLM providers through one OpenAI-compatible interface, as a Python SDK or self-hosted proxy
Pydantic AI
Python agent framework from the Pydantic team for building type-safe, model-agnostic generative-AI applications and workflows
