Skip to content

Law AI — Agent Roles & Specifications

Every agent that exists or is planned — its status (Live, Stub, Not started), responsibilities, tools and the module that implements it.

This document defines every agent that exists or is planned for Law AI. All agents must follow the rules in AGENTS.md.

Status markers used below: Live (real implementation, exercised by tests), Stub (class exists and is wired up, but the core logic is an honest no-op placeholder), Not started (no code anywhere in the repo). This mirrors the actual set under backend/law_ai/agents_runtime/crews/ and backend/law_ai/agents_runtime/graphs/, and the registered set in backend/law_ai/agents_runtime/registry.py.

Runtime LLM note: every "Live" agent below that calls an LLM does so through the shared provider chain in law_ai.core.llm — Claude over OAuth, then Claude over ANTHROPIC_API_KEY, then xAI Grok over a subscription OAuth token (inert until make xai-login), then local Ollama as the last-tier fallback (LLM_PROVIDER_CHAIN, specs 034 and 050; see llm-provider-chain.md and docs/constitution.md §1).

Privileged-data pin. The first three tiers send prompt text off the host, so LLM_PROVIDER_CHAIN=ollama is the only configuration that keeps it local — and it is required, not optional, for any matter under a confidentiality obligation that forbids third-party processing (docs/constitution.md §1, ADR 0005, ADR 0007). Pin it before running any agent below over privileged material; every call records which tier actually served it as an llm_call AuditEvent, so the pin is verifiable after the fact. The LegalBench harness is pinned to Ollama independently, so eval scores stay comparable (docs/architecture.md). None of these agents are CrewAI Crew/Agent/Task objects — despite the crews/ directory name, they are plain Python classes with an async run(); no file under agents_runtime/crews/ imports crewai.

Current Agents (MVP)

Role Type Core Responsibility Critical Tools Structured Output LegalBench Tasks Used1 HITL?
Ingestion Scout Data Parse opinions, extract citations (Eyecite) + entities, route low-confidence items to HITL queue. Live at backend/law_ai/ingestionapp/services/scout.py. CourtListener client, Eyecite, Neo4j writer ExtractionResult + confidence Entity extraction, NLI Yes (low confidence)
Legal Analyst Reasoning Produce IRAC brief, issue spotting, argument mapping — delegates to LegalWorkflow (LangGraph) by default. Live at backend/law_ai/agents_runtime/crews/legal_analyst.py. GraphRAG retriever (LegalWorkflow), shared provider chain (structured-output JSON on the Claude tiers) IRACOutput — issue/rule/application/conclusion + sources + confidence/degraded/requires_review Rule QA, Issue Spotting Optional
Precedent Hunter Retrieval Find on-point, analogous, and distinguishing cases. Live at backend/law_ai/agents_runtime/crews/precedent_hunter.py — run() calls the shared GraphRAGRetriever and returns ranked Precedent rows straight from the graph (each with source_url, court, year, retrieval_mode, source, node confidence). Zero results and graph faults stay degraded=True at confidence 0.0 with the retriever's coverage note relayed verbatim (constitution §4/§13: never fabricate case law, and absence is reported as absence from this corpus). Neo4j fulltext over :Case and :StatuteSection, fused with the nomic-embed-text vector top-K on both labels by reciprocal-rank fusion, plus one CITES hop — all via agents_runtime/tools/graph_rag.py (vector leg shipped in BL-20260810-17; skipped, and flagged in the coverage note, when the index or the local embedder is absent) PrecedentList + justification Precedent retrieval No
Logic Weaver Reasoning Build argument maps, detect fallacies, score strength. Not started — no class exists; registration is commented out in registry.py. Target design: custom reasoning prompts, entailment ArgumentGraph + fallacy list NLI, Fallacy detection No
Educator Education Explain LSAT/Bar answers, generate drills, track skills. Not started — no class exists; registration is commented out in registry.py. Target design: question bank, performance DB, subgraph Explanation + next_recommended Reading Comp, Logical Reasoning No
Orchestrator Meta Decompose request, route to agents, manage state, HITL. Not started — no class exists; registration is commented out in registry.py. Today's closest real analogs are the per-workflow LangGraph graphs — LegalWorkflow and TopicFrontier — both compiled StateGraphs, but each scoped to a single workflow rather than a general-purpose router. Target design: LangGraph state machine, shared memory WorkflowTrace + final artifact All (meta) Yes (high-stakes)
TopicFrontier Autonomy Identify orphan citations + under-cited jurisdictions; prioritise ingestion targets via the shared provider chain (Claude first, Ollama last); dispatch through IngestionScout. Live at backend/law_ai/agents_runtime/graphs/topic_frontier.py. Neo4j Cypher helpers, shared provider chain, SOURCE_REGISTRY, IngestionScout TopicFrontierOutput (Pydantic) core_reasoning, precedent_retrieval No (dispatches through IngestionScout HITL gate)
LSATContentAuthor Autonomy / Education Draft new LSAT (LR/RC/LG) questions targeting the (section, concept) pairs where learners score lowest. All drafts land in the HITL proposal queue; a human reviewer must approve before promotion to the live question bank. Live at backend/law_ai/agents_runtime/crews/lsat_content_author.py. Shared provider chain (Claude-first; structured-output JSON schema pins the Claude tiers; local Ollama last-tier fallback), LSAT bank + passage catalog, gap_analysis, proposals JSONL store GenerateQuestionsOutput (Pydantic) — drafts, model, confidence, degraded, trace_id Logical Reasoning, Reading Comprehension Yes — every draft requires human approval before entering bank
LSATContentReviewer Autonomy / Education Blind quality review of one LSATContentAuthor draft — stem and choices only, no answer key and no author explanation — scoring clarity, unintended ambiguity (higher is better) and whether a single best answer exists, so a reviewer with fifty pending rows opens the borderline five first. Pre-flag only: it never approves, rejects or promotes (constitution §5); a draft below LSAT_REVIEW_FLAG_THRESHOLD reaches the queue carrying meta.review.flagged. Off with LSAT_CONTENT_REVIEW=false (it doubles model calls per draft). Live at backend/law_ai/agents_runtime/crews/lsat_content_reviewer.py (BL-20260527-04). Shared provider chain via law_ai.core.llm (JSON mode); deterministic lint-only fallback at confidence 0.0 when no provider answers ReviewOutput (Pydantic) — clarity, ambiguity, single_best_answer, overall, flags, rationale, flagged, model, degraded, trace_id Logical Reasoning, Reading Comprehension, Logic Games Yes — advisory only; a human still approves every draft
LSATSolveGuideAuthor Autonomy / Education Draft step-by-step solve guides (progressive hints with typed diagram payloads — sequence boards, grids, symbolic notation, argument maps, passage maps) for existing LSAT bank questions. Drafts land in the HITL proposal queue as proposal_kind="guide"; a reviewer must approve before the guide serves on /api/lsat/questions/<id>/guide. Live at backend/law_ai/agents_runtime/crews/lsat_solve_guide_author.py (spec 045). Shared provider chain (Claude-first, local Ollama last-tier fallback), LSAT bank + passage catalog, solve-guide schema, proposals JSONL store GenerateGuideOutput (Pydantic) — guide, model, confidence, degraded, trace_id Logical Reasoning, Reading Comprehension Yes — every draft requires human approval before serving to learners
LSATGuideReviewer Autonomy / Education LLM judge tier for solve-guide drafts: after the deterministic validate_guide_quality lint passes, it reads the guide against its question and judges pedagogical soundness — does each step follow from the ones before it, and is the symbolization faithful to the rules? The verdict (pass/revise/reject, plus a per-step finding list) rides with the pending proposal in meta.review so a human editor opens the broken ones first. Advisory only: promote_guide_to_bank stays human-triggered and unreviewed (no provider answered) never reads as approval. Live at backend/law_ai/agents_runtime/crews/lsat_guide_reviewer.py (BL-20260830-15). Shared provider chain via law_ai.core.llm (JSON mode); deterministic unreviewed fallback at confidence 0.0 GuideReview (Pydantic) — verdict, symbolization_faithful, step_findings, summary, confidence, model, degraded, trace_id Logic Games, Logical Reasoning, Reading Comprehension Yes — advisory only; a human still promotes every guide
LSATWritingEvaluator Autonomy / Education Read one learner's LSAT Argumentative Writing response against an explicit rubric and return, per criterion, a performance band, a verbatim evidence quotation, and one concrete revision. Formative feedback for a single learner — nothing it produces is promoted into the question bank. Never presented as an official result: LSAC does not score the writing section, so the bands are a study instrument and the producing model + prompt version travel with them (spec 047 NFR-PROV-1). Degrades to a labelled offline placeholder at confidence 0.0 when no provider is reachable — the shipped rubric and annotated model response keep working with no model at all. Every evaluation is an lsat_writing_evaluate event in the same append-only audit store lsat_grade uses, and since BL-20260831-27 /api/lsat/stats reads them back as a writing block (attempts, per-prompt counts, latest and best weighted band, the band trend, degraded count, and the producing model + prompt version) which the lab's Stats tab renders as a trend rather than a headline score. Live at backend/law_ai/agents_runtime/crews/lsat_writing_evaluator.py (spec 047). Shared provider chain (Claude-first, local Ollama last-tier fallback), writing prompt library + rubric catalog EvaluateWritingOutput (Pydantic) — evaluation, model, prompt_version, confidence, degraded, trace_id Argumentative Writing Yes — output is machine-derived feedback and must be labelled as such wherever it is shown
LSATDraftJudge Autonomy / Education Adversarial review of one drafted item: solves it blind, then attacks single-best-answer, ambiguity, distractor quality and leakage. The verdict is advisory metadata on the HITL proposal; inside the spec 054 revise loop a fail or a disagreeing blind key is handed back to the author as critique. Never promotes or rejects anything. Live at backend/law_ai/agents_runtime/crews/lsat_draft_judge.py (BL-20260702-02). Shared provider chain via law_ai.core.llm (structured-output JSON schema on the Claude tiers; local Ollama last-tier fallback); a degraded verdict is flag with confidence 0.0 and decides nothing. JudgeDraftOutput (Pydantic) — verdict (pass/flag/fail, solved_key, key_agrees, ambiguity, issues, confidence, degraded), model, trace_id Logical Reasoning, Reading Comprehension, Logic Games Yes — advisory only; a human still approves every draft
LSATContrastAuthor Autonomy / Education Re-asks one bank question as a different question type on the same stimulus (spec 054): keeps the stimulus verbatim, rewrites the question sentence in the target type's cue phrasing, writes five new choices with each distractor tagged with a named trap, and a learner-facing contrast_note on where the key moved. Accepts a critique from the deterministic gates and the judge, which is what lets the revise loop improve a draft. A degraded run returns no draft — never an offline placeholder. Live at backend/law_ai/agents_runtime/crews/lsat_contrast_author.py (spec 054). Shared provider chain via law_ai.core.llm (structured-output JSON schema); the spec 053 playbook of the target type, the taxonomy's item-writing guidance and one same-type exemplar in the prompt; validate_variation gates + LSATDraftJudge around it via factory/revise.py. ContrastOutput (Pydantic) — draft (ContrastDraft: question fields + variation_of, target_archetype_id, contrast_note, distractor_traps) or None, model, degraded, trace_id Logical Reasoning Yes — every draft is a pending proposal with its revision history; a human approves
LSATQuestionEditor Autonomy / Education Minimal rewrite of one existing bank item to a critique — the objections LSATDraftJudge raised against it as it stands (spec 054). Keeps the item's type, difficulty and, when a contrast set shares it, its stimulus verbatim; returns a change_summary for the reviewer. Filed as a rewrite proposal and promoted in place by a human, so the question keeps its id and its learners' history. Shape errors come back as objections the revise loop feeds into the next round; no draft when no provider answers. Live at backend/law_ai/agents_runtime/crews/lsat_question_editor.py (spec 054). Shared provider chain via law_ai.core.llm (structured-output JSON schema); validate_rewrite gates + LSATDraftJudge around it via factory/revise.py, then a Fable final review (LSAT_FINAL_REVIEW_MODEL). EditOutput (Pydantic) — draft (EditedDraft: question fields + question_id, change_summary) or None, issues, model, degraded, trace_id Logical Reasoning, Reading Comprehension, Logic Games Yes — every rewrite is a pending proposal; a human approves the in-place replacement
LSATTypeReviewer Autonomy / Education Blind read of one bank question's type against the section's archetype menu, without the stamp (spec 054). Agreement with the spec 053 stamp is computed in code, never self-reported; disagreements are filed by lsat_type_review_sweep as typecheck proposals, where approving restamps the item and rejecting keeps the stamp. Cached per prompt version so a sweep resumes without re-billing. Live at backend/law_ai/agents_runtime/crews/lsat_type_reviewer.py (spec 054). Shared provider chain via law_ai.core.llm (structured-output JSON schema); law_ai.lsat.services.llm_cache; degraded on outage or an off-menu pick, and a degraded read is never filed. TypeReviewOutput (Pydantic) — review (stamped_archetype, cue_archetype, model_archetype, agrees, rationale, confidence, used_llm, cached, degraded), trace_id Logical Reasoning, Reading Comprehension, Logic Games Yes — a report; a human decides whether to restamp
CodeLegalReview Review lawmode's advisory legal-risk review of source code (spec 057 P2): eight chains — jurisdiction and industry detection, then privacy, licence, security and export control, accessibility, copyright and sector regulation — as one LangGraph graph, then an aggregate node and a HITL node. Every finding names the authority the model relied on, unverified until P3's research tools. A chain that fails is not_run and makes the report incomplete, never "no findings"; a review where no review chain ran raises (ReviewUnavailableError / ReviewParseError) instead of reporting. The code travels between lines carrying a random per-review marker, so code under review cannot end its own data block, and the detection answers the review chains read outside that block are used only when they are jurisdiction codes or a short domain name (anything else is refused and that chain is not_run). Live at backend/law_ai/agents_runtime/graphs/code_legal_review.py. Shared provider chain via ChatProviderChain (a structured-output JSON schema per chain; prompt_id lawmode.<chain>, prompt_version v1 on every llm_call), versioned prompts under prompts/lawmode/, the PendingReview queue; no research tools yet (P3) ReviewResult (Pydantic) — risks (each with severity, law, jurisdiction, chain, review_status), chains_not_run, unparsed_findings, human_approval_required, disclaimer, metadata (per-chain model and prompt, queue ids, trace_id) None — spec 057 §12: no LegalBench task covers source-code review Yes — critical, high and authority-less findings become lawmode_finding queue items and read awaiting_review; nothing passes or fails a change

1 Except for TopicFrontier's core_reasoning, precedent_retrieval — which are real --subset values — this column names illustrative reasoning-skill categories, not literal flags accepted by the harness. backend/law_ai/eval/legalbench.py only accepts ALLOWED_SUBSETS = {core_reasoning, precedent_retrieval, contract_nli, definitions, causation} (see docs/legalbench.md); the other five rows' categories ("Entity extraction, NLI", "Rule QA, Issue Spotting", "NLI, Fallacy detection", "Reading Comp, Logical Reasoning") don't correspond to a subset the harness can run today.

Planned Agents (Post-MVP)

  • ContractRiskAssessor — Clause classification + obligation extraction + risk scoring (uses CUAD + LEDGAR patterns)
  • StatuteChangeDetector — Monitors legislation.gov.uk / EUR-Lex for amendments affecting user's saved cases
  • CaseOutcomePredictor — Predicts likely outcome based on similar fact patterns + judge history (research only)
  • MultiJurisdictionComparator — Side-by-side analysis across US/UK/EU on same legal issue

Agent Implementation Template

Every agent must expose:

class BaseLawAIAgent:
    name: str
    description: str
    requires_human_approval: bool = False

    async def run(self, input: dict[str, Any]) -> BaseModel:
        ...

    async def stream(self, input: dict[str, Any]) -> AsyncIterator[StreamEvent]:
        ...

See the /new-agent command (.claude/commands/new-agent.md) for the full implementation checklist.