Building the Document Context Layer for AI Agents
AI Engineergo watch the original →
the gist
Jerry Liu argues that RAG in 2026 requires a dedicated document context layer that separates parsing, semantic storage, and agentic workflows to handle the 10 trillion pages of unstructured enterprise data.
The Document Context Layer
Modern RAG has evolved from simple top-k retrieval into an agentic harness that reasons about search queries and task execution. Because raw file formats like PDF are designed for printing rather than machine consumption, they lack inherent reading order and structural semantics. The proposed architecture for an agent-native document platform consists of three layers: a parsing layer to convert files into token-efficient markdown and metadata, a semantic storage layer for agent-accessible document management, and a workflow layer for repeatable tasks like KYC or invoice processing.
Hybrid Parsing Strategies
Parsing strategies currently sit on a spectrum between heuristic-based pipelines and one-shot Vision Language Model (VLM) reads. Heuristic pipelines are fast but often fail on complex layouts, while VLMs are accurate but expensive and prone to hallucinations on text-heavy pages. The optimal approach involves a hybrid routing system that uses cheap, specialized models for standard text and reserves frontier VLMs for complex elements like tables and charts.
Low-Latency Processing with LightParse
To handle high-volume document ingestion, such as processing 1,000 uploads in a minute, developers should implement a two-pass strategy. The first pass uses a high-speed, non-VLM parser to scan the corpus, while the second pass uses a VLM-based tool only when the agent requires deep visual inspection of specific pages. LightParse, an open-source Rust-based parser, serves as the primary tool for this initial high-speed pass, providing accurate markdown output without the latency or cost overhead of model-based inference.