← Applied AI
Applied AI· 1 min read

A Multi-Agent Legal Research Workflow

.NETAI EngineeringIndian Case Law

Summary

Discovery, analysis, verification, and the report share one typed state and can resume after a stop.

Companion code: 08-multi-agent in indian-legal-ai-lab.

Previous: Part 7: Agentic RAG and Precedent Research

Discovery, reading, citation checks, and the report are different jobs. They share one `ResearchState` so a stopped run can continue from the stage it reached.

The state is the handoff

`ResearchState` holds the question, discovered passages, analysis lines, verification notes, the report, and a stage string. Stages used by the code are `new`, `discover`, `analyze`, `verify`, `report`, `insufficient`, `refused`, and `completed`.

`ResearchWorkflow.RunAsync` does not restart work that is already done:

  • `DiscoverIfNeeded` runs only when the stage is `new` or `discover`.
  • `AnalyzeIfNeeded` runs only for `analyze`.
  • `VerifyIfNeeded` runs only for `verify`.
  • `WriteIfNeeded` runs only for `report`, then sets `completed`.

`JudgmentAnalysis` groups passages by case id, takes three cases, and describes them in parallel with `Task.WhenAll`. Each line is `{caseId} ({citation}) has {count} retrieved passage(s). Synthetic={flag}.`

`ResearchReportWriter.Write` fills question, cases, findings, evidence, one competing-interpretation sentence, limitations, references, and `HumanReview`. The limitations say the corpus is small, metadata-only judgments have no full text, citation links are string matches, and the product is not legal advice. `Empty` is the report used for a refusal or for insufficient evidence.

dotnet run --project labs/08-multi-agent

`Article 19 speech Romesh Thappar` ends at stage `completed` and prints a verification line per retrieved chunk. The four roles are stages in one process. They are not four model conversations.

Next

Part 9: Event-Driven Judgment Ingestion

Verified in this revision

The stages are still `new`, `discover`, `analyze`, `verify`, `report`, `insufficient`, `refused`, and `completed`. The API passes the request cancellation token only as `ThrowIfCancellationRequested` before `RunAsync`. The workflow method itself does not take a token.

More in Applied AI