Legal AI agents for case research

Extract text from contracts and filings, search entire case libraries by meaning, and remember case context across sessions, so the agent can find the relevant clause in 10,000 pages of discovery.


Legal work runs on documents and precedent. The relevant fact is somewhere in the filing, the binding clause is buried in the contract, the precedent that decides the matter is one paragraph in a judgment among thousands. A legal AI agent is only as good as its ability to get text out of those documents, find the right passage across an enormous corpus, and carry what it has learned about a matter from one session to the next.

The model can read and reason about legal language well. The work is getting the documents into a form it can use, searching them in a way that finds meaning rather than matching words, and holding the context of a matter so the agent doesn't start every session from nothing. This page is about that infrastructure.

A scope note first: this page is about the data infrastructure beneath a legal agent, not about legal advice, privilege, or what any deployment must do to meet professional and regulatory obligations. Those are matters for your own review.


The problem

The first obstacle is the documents themselves. Contracts, filings, and discovery arrive as PDFs and scans, often hundreds or thousands of pages, in inconsistent formats. Before an agent can do anything useful, the text has to come out cleanly, with structure intact, and that alone defeats a lot of naive setups. Discovery in a single matter can run to tens of thousands of pages, far past what fits in any context window, so loading it all into a prompt is a non-starter.

The second obstacle is finding the right passage. The clause that matters rarely contains the words you'd search for, and legal language is precise in ways that defeat keyword matching: a non-compete might never use the phrase "non-compete," an indemnity might be phrased six different ways across six agreements. Keyword search over a large corpus returns either a flood or nothing, neither of which helps. And at the scale of a real document library, search quality itself degrades unless the underlying retrieval is built for it, the semantic collapse problem that bites precisely when the corpus gets large enough to matter.

The third is continuity. A matter unfolds over weeks or months. An agent that forgets the case context between sessions makes the lawyer re-establish where things stand every time, which defeats much of the point of having an agent at all.


What Exabase unlocks

With clean extraction, search that finds by meaning, and memory that persists across a matter, the agent becomes genuinely useful on the document-heavy work that consumes so much legal time.

Point it at a contract or a filing and it gets the text out with structure preserved, ready to work with, regardless of whether the source was a clean PDF or a scan. Ten thousand pages of discovery become something the agent can actually search rather than an undifferentiated heap.

Ask it for every non-compete clause across all the vendor agreements, and it returns the actual clauses, including the ones phrased in ways that never use the word, because it searches by meaning. Ask where a particular obligation appears across the corpus and it finds each instance, not just the documents that happen to share your phrasing. The relevant clause in a vast pile of discovery stops being a needle in a haystack and becomes a query.

Come back to a matter after a fortnight and the agent already holds the context: the parties, the key dates, the issues in play, where the research left off. It picks up where it stopped rather than asking the lawyer to rebuild the picture.


How it works

Three primitives carry a legal research agent, with extraction and search leading because the work is so document-heavy.

Extract

Extract turns documents into clean, structured text through one API. Contracts, filings, discovery, whether PDF or scan, go in, and you get back text chunked with page numbers, so a later answer can cite where it came from. It handles large files, which matters when a single filing runs to hundreds of pages, and it's the step that makes everything downstream possible: nothing can be searched or remembered until it's been read out of the document cleanly. The contract analysis use case and document extraction at scale go deeper on the extraction side if that's the core of your need.

Deep Search

Deep Search is how the agent finds the right passage across the whole corpus. It searches at the paragraph level, semantically rather than by keyword, so an indemnity clause surfaces regardless of how it's worded, and a search for an obligation finds every instance across thousands of pages. It's hybrid by default, combining semantic matching with typo-tolerant keyword search, so exact terms like a defined party name or a section reference still land precisely while conceptual queries still work. Results come back as scored chunks with their location, ready to hand to the model.

Memory

Exabase Memory holds the context of the matter across sessions: the parties, the key dates, the issues, the state of the research. You send in the work as it happens and Exabase extracts what's worth keeping, and when facts about the matter change, the new state supersedes the old rather than coexisting with it. That contradiction handling is what keeps a long-running matter's context accurate, and it's the difference between a memory layer and a pile of session logs.


Example architecture

The flow is straightforward to wire up.

Scope per matter. Create one Base per matter or client so documents, search, and memory stay cleanly separated, which also keeps one client's material from ever surfacing in another's, a separation that matters a great deal in legal work.

On ingestion, run each document through Extract to get clean text, then store the results as Resources in the matter's Base, where they're indexed for search.

On research, the agent runs a Deep Search across the matter's documents to find relevant passages, and retrieves memory for the matter's running context. As the work produces conclusions worth keeping, they go back to Memory.

Documents flow in through extraction and become searchable Resources; the matter's context accumulates in memory; the agent reads from both on every research session. Each matter's material stays sealed in its own Base.


What compounds over time

A legal research agent built this way gets more valuable as the matter and the firm's library grow, which is the opposite of how manual review scales.

Within a matter, every document added enlarges what the agent can search, and the running memory of the matter gets richer and stays current as the research progresses, since the memory self-organises rather than silting up. Across matters, the firm accumulates a searchable corpus of everything it has ever extracted, so the cost of getting a document into usable form is paid once and the value is drawn on indefinitely.

The contrast with the do-it-yourself route is sharpest here. An extraction pipeline you build and a search index you tune get harder to maintain as the corpus grows, and search quality is exactly what tends to break down at scale when the retrieval isn't built for it. Infrastructure that holds its search quality as the library grows is the bet worth making when the library only ever gets bigger.


Who's building this

Teams building legal research tools, contract analysis agents, discovery assistants, and due-diligence tools, anywhere an agent works across large document sets and needs to find precise passages and carry matter context over time.

The contract analysis use case is the closest neighbour to this one and worth reading alongside it, and the document extraction at scale use case covers the ingestion side in depth. For a hands-on starting point, the simple document extraction tool example builds the core extract-and-search loop end to end.


Get started

Start with the getting started guide, then about extraction and submitting jobs for the document side, and searching resources for the search side. There's a free tier to build against. As with any legal deployment, the question of professional and regulatory appropriateness is one for your own review.


FAQs

Can it handle scanned documents, not just clean PDFs?

Yes. Extract reads scans as well as native PDFs and returns clean, structured text with page numbers, so a passage an answer relies on can be traced back to its source page.


How does it find a clause that never uses the obvious term?

Deep Search matches by meaning rather than keyword, so a non-compete or an indemnity surfaces regardless of the exact wording. It's also hybrid, so a defined term or a specific section reference still matches precisely when you need an exact hit.


Does search quality hold up across tens of thousands of pages?

That scale is exactly where naive vector search tends to fail, the semantic collapse problem. Deep Search is built to hold retrieval quality as the corpus grows rather than degrading once the library gets large.


How is one matter or client kept separate from another?

Put each matter in its own Base, which fully isolates its documents, search, and memory from every other matter. Operations scoped to a Base can only see that Base's data.


Does the agent remember a matter between sessions?

Yes. Exabase Memory holds the matter's running context, parties, dates, issues, state of research, and keeps it current as things change through contradiction resolution. The agent resumes where it left off rather than starting cold.


Does Exabase provide legal advice or assess privilege?

No. Exabase is data infrastructure: extraction, search, memory, and isolation. What the agent does with the material, and whether a given use is professionally and legally appropriate, is determined by you and your own review, not by Exabase.


Ship your first app in minutes.

Ship your first app in minutes.