LlamaIndex released legal-kb: agentic document search through four tools on Index v2
LlamaIndex published the legal-kb reference application—it grants AI agents access to a document corpus in a file-system-like manner on top of Index v2. The…
AI-processed from MarkTechPost; edited by Hamidun News
On July 5, 2026, LlamaIndex published a public reference application called legal-kb—an open template for agent-powered search across a corpus of documents built on Index v2.
What legal-kb can do
The application builds a knowledge base with filesystem-style access: the agent works with documents not through a single RAG query, but through four specialized tools.
- retrieve — hybrid semantic search across the entire knowledge base
- find — document search by name or metadata
- read — read the full contents of a specific file
- grep — exact text search within documents
This set of tools allows the agent to work methodically. Upon receiving a query, it first performs a semantic retrieve to find relevant documents, then refines through find using metadata, reads the full text via read, and verifies exact phrasing through grep. This fundamentally differs from classic RAG, where all search occurs in a single step without the possibility of refinement.
Technical stack and key features
The application is built on four components:
- TanStack Start — server-side rendering and routing
- AI SDK 6 with ToolLoopAgent — tool invocation loop management
- Prisma — ORM for database operations
- WorkOS — authentication and user access management
In addition to search tools, legal-kb implements two important features. The first is automatic file versioning: each document receives a version upon upload, and the system records which specific revision the agent relied on when answering. The second is visual citations: the interface shows the user the exact fragment from the source document where the information came from.
For the legal context that the name legal-kb clearly alludes to, both features are critically important. An incorrect reference to an outdated version of a contract or an inaccurate quote from a regulatory document can have serious consequences. Versioning and visual citations directly mitigate this risk, making the agent's work transparent and verifiable.
Why developers need this
Legal-kb is published as a reference application: its code is open and serves as an architectural example for teams building enterprise AI systems based on proprietary documents. Typical use cases include contract analysis, searching regulatory guidelines, and working with internal policies and procedures.
Index v2 is becoming the foundation for an increasing number of agentic applications in the LlamaIndex ecosystem. By publishing legal-kb as a public example, the company shows developers how to properly combine multiple search tools in a single agent cycle—instead of relying on a single monolithic RAG call. For teams needing high-precision source attribution, it's a ready-made starting point.
What this means
Agent-powered search with a set of specialized tools is gradually displacing one-shot RAG in tasks where accuracy and source traceability matter more than speed. Legal-kb is a practical template that developers can use as a foundation for enterprise solutions with similar requirements.
Want to stop reading about AI and start using it?
AI News is a curated feed of AI/tech news. Hamidun Academy teaches you to use AI systematically in your work.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.