Rekalldocs
Recipes

LangChain & LlamaIndex retriever swap

Swap your vector retriever for Rekall in one line. Whole-document ingestion kills the chunking pipeline; the reasoning loop handles the queries similarity search fails on.

Rekall ships LangChain and LlamaIndex adapters in-package (Python) — one import each. Swap an existing retriever for Rekall without touching the rest of your chain, and delete your chunking pipeline while you're at it.

No chunking, no reindex

Vector retrievers force a chunking strategy — the fiddliest part of every RAG pipeline. Rekall ingests whole documents; SKIM's hierarchical attention reads long docs at ~O(L). Nothing to tune, nothing to reindex.

LangChain

chain.py
from rekall.integrations.langchain import RekallRetriever
from langchain.chains import RetrievalQA
from langchain_anthropic import ChatAnthropic

retriever = RekallRetriever(store="contracts", max_hops=4, max_results=5)

qa = RetrievalQA.from_chain_type(
    llm=ChatAnthropic(model="claude-opus-4-8"),
    retriever=retriever,
)
answer = qa.invoke("which supplier contract conflicts with the 2026 policy?")
chain.py
from langchain_community.vectorstores import FAISS
from langchain.text_splitter import RecursiveCharacterTextSplitter

# Chunking + embedding + index build — all gone with Rekall.
chunks = RecursiveCharacterTextSplitter(chunk_size=1000).split_documents(docs)
vs = FAISS.from_documents(chunks, embeddings)
retriever = vs.as_retriever(search_kwargs={"k": 5})

RekallRetriever returns LangChain Documents whose metadata carries the passage score, hop, and the result-level confidence, so downstream steps can branch on them.

LlamaIndex

query_engine.py
from rekall.integrations.llamaindex import RekallRetriever
from llama_index.core.query_engine import RetrieverQueryEngine

retriever = RekallRetriever(store="contracts", max_results=5)
engine = RetrieverQueryEngine.from_args(retriever)

response = engine.query("which supplier contract conflicts with the 2026 policy?")

The retriever yields LlamaIndex NodeWithScore objects — drop it into any query engine, router, or sub-question pipeline in place of a vector retriever.

Generic agent tool

For agent frameworks that speak the Anthropic/OpenAI tool schema, as_tool() hands you a ready tool definition backed by the reasoning loop:

as_tool.py
tool = store.as_tool()   # or rekall.as_tool() to expose all stores

# tool == {
#   "name": "rekall_search",
#   "description": "Reasoning-grade retrieval over the 'contracts' store.",
#   "input_schema": {
#     "type": "object",
#     "properties": {
#       "query":    {"type": "string"},
#       "max_hops": {"type": "integer", "default": 4},
#       "max_results":    {"type": "integer", "default": 5}
#     },
#     "required": ["query"]
#   }
# }

import anthropic
client = anthropic.Anthropic()
msg = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=1024,
    tools=[tool],
    messages=[{"role": "user", "content": "Any contracts that conflict with policy?"}],
)

When the model calls the tool, hand the arguments to store.search(**args) and return the SearchResult — the agent sees passages, confidence, and the trace.

Prefer MCP for agents?

If your agent host speaks MCP (Claude Code, Claude Desktop, Cursor), skip the glue: run rekall mcp and the tools are wired automatically. See the MCP guide.

On this page