How it works

From a prompt to a cited legal artefact in six steps.

Every request through LawDep follows the same path — whether it comes from the UI or the copilot. The AI has no back-door: it uses the same tools you do.

  1. 01

    A user asks for something

    Either in the chat copilot ("draft a mutual NDA with these terms") or in the UI (clicking "New contract"). Both paths land on the same service function.

    "Draft a mutual NDA between Acme, Inc. (Delaware) and Rivet Labs Pvt Ltd (India). 2-year term. Non-compete carveout for research staff."
  2. 02

    The agent picks the right tool

    The LLM sees a menu of 28 typed tools — each one a Pydantic-validated JSON schema. It picks `draft_nda`, extracts the parties, term, and jurisdiction, and issues a tool_use block.

    draft_nda({party_a: "Acme", party_b: "Rivet Labs", term_years: 2, mutual: true, jurisdiction_a: "US-DE", jurisdiction_b: "IN-KA"})
  3. 03

    The tool calls the service layer

    The tool doesn't hit a fake API — it calls the same service function your UI calls. Multi-tenancy is enforced. Entities are looked up in Postgres. Templates are pulled from disk.

    entity_service.get('Acme') → contract_service.create(...)
  4. 04

    The LLM drafts against your playbook

    Claude Sonnet 4.5 (or MiniMax M2.7) drafts the document. Every clause is compared to your playbook. Deviations are annotated with a risk score.

    playbook.check(clause) → risk_score: 0.15 · deviation: none
  5. 05

    The draft is persisted with provenance

    The contract lands in the same Postgres table as every other contract. The draft carries the template ID it was generated from, the prompt hash, and the model version. Everything is auditable.

    INSERT INTO contracts ... RETURNING id
  6. 06

    Downstream calendars update automatically

    The compliance calendar picks up the renewal date. The IP module reads the linked assets. The chat copilot can now cite this contract in future questions.

    compliance_calendar.recompute(org_id)

The anatomy

Six layers. No black boxes.

L1

Presentation

Next.js 15 App Router

The UI and the marketing site are one Next.js codebase. Server components fetch data at request time; client components handle interaction.

L2

API

FastAPI on Python 3.11

REST endpoints under /api/v1/*, protected by JWT auth. Every request resolves the caller's organization from their session and scopes all queries to it.

L3

Service layer

Python functions with a uniform signature

Every service function takes (args: dict, ctx: RequestContext) and returns a dict. The tool registry maps LLM tool calls onto these same functions.

L4

LLM gateway

OpenRouter or MiniMax, one env var away

app/llm/factory.py picks the client based on LLM_PROVIDER, with retries and exponential backoff in the wrapper. Models are configured per-environment, never hardcoded in service code.

L5

Persistence

Postgres 16 + pgvector, Redis for queues

SQLAlchemy models with organization_id on every row. Embeddings live in the same Postgres — no separate vector DB.

L6

Background work

Arq worker on Redis

Document parsing, chunking, embedding — all runs off the request path. The worker shares the codebase with the API service.

Try it

Stop running a legal department out of a shared drive.

Click through a live demo workspace — no login, no credit card. Browse contracts, run an AI review, watch it flag an invented citation. When you’re ready, we’ll stand up a workspace for your team.

Or explore a free tool: compliance calendar · watch AI catch a fake case

LawDep is not a law firm and does not provide legal advice. All AI-generated content is marked as such and should be reviewed by qualified counsel before use.