LangGraph Multi-Agent Underwriting: 12 Agents, One State
How a LangGraph multi-agent underwriting assistant is built: 12 agents, one shared state, durable checkpoints, human review and how to scope it.
Underwriting teams lose analyst hours before any credit judgment happens. Each applicant sends a P&L, a balance sheet, subscription data and bank statements in different formats and languages, and someone re-keys them into one template. A wrong number that slips through that step is worse than a slow one, because the credit report then rests on it. A LangGraph multi-agent design attacks this by splitting the job into narrow agents, checking the output with arithmetic and asking a person only when the arithmetic still fails.
This LangGraph multi-agent walkthrough covers how we built that for UW Assistant, our own multi-agent underwriting engine: 12 agents, one shared run state, durable checkpoints and a human-review pause. It is written for developers and architects deciding whether LangGraph fits a production agent system. You can see the product at /projects/uw-assistant/ and try the read-only demo (fictional companies only) at uw.byteandrise.com.
Why one prompt fails and a LangGraph multi-agent graph works
An earlier version of this work was a single-prompt workflow: hand a model the whole statement and ask it to rewrite it into a standard layout. That fails silently. The output looks plausible, a total is off by a small amount, and nothing flags it. For underwriting, silent errors are the cost that matters, so we measure them directly (more on that below).
The LangGraph multi-agent redesign rests on one rule: models choose labels, code moves numbers, and arithmetic decides whether the result is right. A model never rewrites a figure; it picks the taxonomy line a source row belongs to. Code copies the amounts, so a number cannot change in transit. Accounting identities, such as the balance sheet balancing in every period, decide whether the mapping is acceptable.
The normalization problem is covered in financial statement normalization with AI. Here the focus is the graph that runs it.
The 12 agents and one shared run state
LangGraph models a multi-agent application as a graph of nodes that read and update a shared state object (LangGraph docs). We use that directly: each agent is a node with one job, and they all work on one run state instead of passing messages to each other.
| Agent | One job |
|---|---|
| Intake | Accept files (Excel, CSV, digital PDF, scanned pages) and register the run |
| Structure | Find tables, periods and units in each file |
| Triage | Decide which path each document takes |
| Subscriptions | Handle subscription data |
| Bank | Handle bank statements |
| Map | Map source rows to one taxonomy |
| Understand | Resolve rows the cheap layers could not place |
| Check | Test accounting identities in every period |
| Repair | Propose fixes for failing checks |
| Review | Pause for a person and take the answer |
| Key figures | Compute figures for the credit view |
| Report | Draft the credit report, every number citing its source cell |
The path is: read, map, check against identities, repair, ask a person only about rows that still fail, report. A person makes the credit decision. The score is advisory and computed by code from the lender's policy, not by a model.
Why a shared state rather than agent-to-agent chat? Every intermediate result stays inspectable, and you can test a node by feeding it a fixed state and asserting on what it returns.
Deterministic first, model only when unsure
Most of the work does not need a model. The free layers, which use local multilingual embeddings (ONNX), text extraction with pdfplumber and local Tesseract OCR for scanned pages, map 82% of rows on our evaluation set. Adding the model layer brings that to 98%.
| Layer | Runs where | What it does |
|---|---|---|
| Rules and memory | In process | Exact matches and answers a person already gave for this tenant |
| Embeddings | Local ONNX | Nearest taxonomy label across languages |
| Claude Sonnet | API | Picks a label for the rows left over; sees labels, never amounts |
| Claude Opus | API | Writes report narrative; numbers appear only as placeholders |
Two guardrails matter. Amounts are never sent to the mapping model, so it cannot misquote a figure. The narrative model writes with placeholders that code fills in, and a gate removes any sentence where the model wrote a number itself.
Cost follows from the ordering. On the evaluation gate, the model layer costs about $1.10 for all 77 scenario runs. That figure is for our test scenarios, not a quote for your volume, but it shows why "deterministic first" is a cost decision as well as an accuracy one. For your own budget, start with the AI agent cost calculator.
Checks, repairs and the rule that makes them safe
The Check agent tests accounting identities against the mapped data: totals equal the sum of their parts, the balance sheet balances, and cash movements reconcile, in every period. Repair then tries fixes, such as moving a row to a different line.
The acceptance rule is strict: a fix is accepted only if it makes the identity hold in every period at once. A change that repairs one year and breaks another is rejected. Whatever still fails becomes one short question to a person.
Answers are remembered per tenant, so the same question is not asked twice and the number of questions falls over time. In the live demo (a fictional Swedish SaaS company), 108 of 108 checks reconcile, 30 rows are mapped, 0 questions are raised and the advisory score is 95.
The evaluation gate runs on every change: 77 scenario runs and 2,106 rows with 0 silent errors, where a silent error means a wrong number that passes unnoticed. For how to build that kind of gate for your own agents, see AI agent evaluation and quality gates.
Durable checkpoints and the human-review interrupt
Underwriting does not finish in two seconds. A run may wait hours for an analyst. LangGraph handles this with checkpointers, which save graph state so a run can resume later, and with interrupt(), which suspends the graph at a node and stores state (LangGraph interrupts). We use Postgres checkpoints so a paused run survives a restart.
Resuming is done by calling the graph again with the same thread ID and a Command(resume=...) value, which becomes the return value of the interrupt() call. There is a detail that bites teams: on resume, the node restarts from its beginning, not from the line of the interrupt. Anything before the interrupt runs again.
Our rules for the Review node follow from that:
- Keep work before
interrupt()idempotent, or move side effects after it. - Never wrap
interrupt()in a bare try/except, which would swallow the pause. - Call interrupts in the same order every time.
- Store the question and the person's answer in the run state, so the audit trail shows who answered what.
In finance, knowing when to ask a human has to be built into the graph, not left to a prompt instruction.
Book an AI scoping call
Bring one workflow. We'll tell you if an agent should run it.
Book an AI scoping call →Multi-tenant data with row-level security
UW Assistant is a multi-tenant SaaS: an admin creates tenants, and each tenant's data and remembered answers are separate. We enforce that in Postgres with row-level security per tenant, so isolation does not depend on every query in the application remembering a filter (PostgreSQL row security policies).
The trade-off: every database path, including the queue worker, must set the tenant context correctly. A forgotten context is a data-isolation bug, so we test that path as hard as the model path.
Failure modes we designed against
| Failure | Where it shows up | Control |
|---|---|---|
| Model rewrites a number | Whole-statement prompts | Models pick labels only; code moves amounts |
| Plausible but wrong mapping | Ambiguous row names | Identities checked in every period |
| Fix that helps one period and breaks another | Repair step | Accept only if all periods hold |
| Invented figures in the narrative | Report drafting | Placeholders plus a gate that removes number-writing sentences |
| Cross-tenant data access | Database | Row-level security |
How ByteandRise would approach this for your company
Your documents, taxonomy and risk policy are not ours, so we would not copy this graph. A LangGraph multi-agent build for your company would run in three stages.
- Scoping sprint. We review a sample of your real intake documents (under NDA), the systems they come from, and your credit policy. We list the identities that must hold, the points where a person must decide, and a cost model for build and running costs. You get a written recommendation and plan your team can act on with or without us.
- Pilot build. One document type and one workflow, wired to your systems in staging or limited production. We agree an evaluation set and pass criteria up front, include the human-review step and add a usage and cost dashboard.
- Production build. We extend coverage, add monitoring and hand over with documentation. Deployment goes where your data lives, as a capability: Azure AI Foundry, Google Vertex AI, AWS Bedrock or Claude Platform.
The hard question is often whether you need agents at all. The agent or workflow tool gives a first answer, and our AI agents service page describes the engagement in full. Book an AI scoping call and leave with a view on which of your document flows suits a graph like this, where a person must stay in the loop, and a first cost model.
One Docker image today, three clouds next
The system ships as one Docker image: a FastAPI service plus a Postgres-backed queue worker. The live demo runs on AWS (Stockholm) today. Azure AI Foundry, Google Vertex AI and AWS Bedrock versions are planned, not yet built, and we do not claim a lender uses it. One image keeps the move mostly packaging and configuration, but each provider's model endpoints still need testing against the evaluation gate. For how those platforms compare, see Azure AI Foundry vs Vertex AI vs Bedrock vs Claude Platform.
Checklist before you build a LangGraph multi-agent system
- Can one model rewrite the whole artifact? If yes and it fails silently, split the job.
- Is there arithmetic or a rule that proves the output right? Build that gate first.
- Does a deterministic path handle what it can before any model call?
- Does the pause for a person survive a restart, and is the node safe to re-run?
- Is tenant isolation enforced in the database, not only in code?
- Do you measure silent errors, not only accuracy?
FAQ
Why use LangGraph for a multi-agent underwriting system?
It gives you a shared state, durable checkpoints and a built-in pause for human review. Those three features match underwriting, where runs are long and a person must sometimes answer.
Do the agents talk to each other?
No. Each agent reads and updates one shared run state, which keeps every intermediate result inspectable and each node testable on its own.
Does the model ever see the numbers?
The mapping model sees labels only, never amounts. The narrative model writes with placeholders that code fills in, and a gate removes sentences where it wrote a number.
Can you run this on Azure, Google Cloud or AWS Bedrock?
The live demo runs on AWS (Stockholm) today. Azure AI Foundry, Google Vertex AI and AWS Bedrock versions are planned, not built.
What does an AI scoping call cover?
Your documents, the checks that must hold, where a person decides, and a first cost model for build and running costs.
