AI Document Search: LlamaIndex Releases legal-kb for Free

LlamaIndex has published legal-kb, a reference application that gives AI agents file-system-style access to a document corpus on top of Index v2. The agent works through four tools: retrieve (hybrid semantic search), find, read and grep. The system supports automatic file versioning and visual citations that point to the exact source passage. The stack is TanStack Start, AI SDK 6 with ToolLoopAgent, Prisma and WorkOS.

AI-processed from MarkTechPost; edited by Hamidun News
AI Document Search: LlamaIndex Releases legal-kb for Free
Source: MarkTechPost. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceMarkTechPost ↗
Editor-in-Chief
Retrievehybrid semantic search across the whole knowledge base
Findlocates a document by name or metadata
Readreads the full contents of a specific file

On July 5, 2026, LlamaIndex released legal-kb, a free AI tool for agentic document search built on Index v2.

What legal-kb does

The app builds a knowledge base with file-system-style access. Instead of a single RAG query, the agent works with documents through four specialized tools:

  • retrieve: hybrid semantic search across the whole knowledge base
  • find: locates a document by name or metadata
  • read: reads the full contents of a specific file
  • grep: exact text search inside documents

This toolset lets the agent work methodically. Given a query, it first runs a semantic retrieve to find relevant documents, then narrows results with find using metadata, reads the full text with read and verifies exact wording with grep. This differs fundamentally from classic RAG, where the whole search happens in one step with no chance to refine.

Technical stack and key features

The app is built on four components:

  • TanStack Start: server-side rendering and routing
  • AI SDK 6 with ToolLoopAgent: manages the tool-calling loop
  • Prisma: ORM for database access
  • WorkOS: authentication and user access management

Beyond the search tools, legal-kb implements two important features. The first is automatic file versioning: each document gets a version on upload, and the system records which revision the agent relied on when answering. The second is visual citations: the interface shows the user the exact passage from the source document that the information came from.

For the legal context that the name legal-kb clearly hints at, both features are critical. A wrong 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 reduce this risk by making the agent's work transparent and verifiable.

Why developers should care

Legal-kb is published as a reference app: its code is open and serves as an architecture example for teams building corporate AI systems on closed document sets. Typical use cases include contract analysis, search through regulatory guidance, and work with internal policies and procedures.

Index v2 is becoming the foundation for a growing number of agentic applications in the LlamaIndex ecosystem. By publishing legal-kb as a public example, the company shows developers how to combine several search tools in a single agent loop, rather than relying on one monolithic RAG call. For teams that need highly accurate source references, it is a ready-made starting point.

What this means

Agentic 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 basis for corporate solutions with similar requirements.

How does an AI tool for document search work?

legal-kb uses four tools: retrieve (semantic search across the knowledge base), find (document lookup by name/metadata), read (reading full contents), grep (exact text search).

Can AI be used to analyze legal documents?

Yes, legal-kb is a template designed specifically for working with a document corpus through agentic search.

Story

Key Questions Answered

How does an AI tool for document search work?

legal-kb uses four tools: retrieve (semantic search across the knowledge base), find (document lookup by name/metadata), read (reading full contents), grep (exact text search).

Can AI be used to analyze legal documents?

Yes, legal-kb is a template designed specifically for working with a document corpus through agentic search.

What legal-kb does?

The app builds a knowledge base with file-system-style access. Instead of a single RAG query, the agent works with documents through four specialized tools: retrieve: hybrid semantic search across the whole knowledge base find: locates a document by name or metadata read: reads the full contents of a specific file grep: exact text search inside documents This toolset lets the agent work methodically. Given a query, it first runs a semantic retrieve to find relevant documents, then narrows results with find using metadata, reads the full text with read and verifies exact wor

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…