From Simple RAG to Multi-Agent Architecture for Document Data Extraction

box · Tech · 2023 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Enterprise document data extraction

Box's initial LLM metadata-extraction system worked on simple documents but broke when enterprise customers supplied long documents, poor OCR, multilingual content, hundreds of fields, and confidence-score expectations.

Constraints:

Architecture

Box rearchitected metadata extraction from a single preprocess-LLM-postprocess path into a multi-agent workflow. Specialized sub-agents group related fields, choose extraction strategies, inspect page images as well as OCR where useful, run quality feedback, and retry with different techniques or model voting when fields look wrong.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  enterprise-documents[Enterprise documents] --> field-grouping-agent[Field grouping agent]
  field-grouping-agent --> extraction-agent[Extraction agent]
  extraction-agent --> quality-feedback-loop[Quality feedback loop]
  quality-feedback-loop --> model-voting[Model voting]
  model-voting --> structured-extracted-data[Structured extracted data]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Enterprise documents Unstructured files such as long contracts or documents requiring metadata extraction. Field grouping agent
Field grouping agent Groups related requested fields so the model extracts coherent sets together. Enterprise documents, Extraction agent
Extraction agent Chooses OCR, page-image, or other techniques to pull requested values. Field grouping agent, Quality feedback loop
Quality feedback loop Judges extracted fields and triggers retries or different techniques. Extraction agent, Model voting
Model voting Uses different models or techniques when feedback indicates an extraction is wrong. Quality feedback loop, Structured extracted data
Structured extracted data Final metadata output returned to enterprise workflows. Model voting

Data flow

A document and requested fields enter the workflow. Rather than one prompt over preprocessed text, the system breaks the extraction problem into sub-agent tasks: field grouping, data extraction over OCR and page images, quality judging, feedback, and retries using alternative models or techniques.

3 supporting quotes
“that hard um and so then we ended up rearchitecting from scratch with an agentic approach so rather than just do”transcript, implied
“we did a steps multi-agent architecture where we separated out the problems that we had into a series of sub aents”transcript, stated
“these parts of the data, maybe it's going to look at the picture of the of the the pages in addition to just the OCR.”transcript, stated

Why this architecture

The multi-agent abstraction let Box isolate each failure mode instead of piling more preprocessing into a single prompt. It made the system easier to evolve as customers brought new document types and extraction requirements.

“this approach really solved a lot of our problems, not just because it um solved the issues at that moment, but because it became easy for us to update.”transcript, stated
“uh u intelligent powered solutions if you do an agentic based approach it's a much cleaner abstraction and um you”transcript, implied

Models used: large language model · LLM-as-judge · OCR models

Scale

Alternatives considered (roads not taken)

Single preprocess-LLM-postprocess pipeline

Rejected because: It worked initially but failed on long, noisy, complex enterprise documents.

“generative AI because the thing that was working so well that was so awesome that was so elegant just didn't work.”transcript, stated

Heuristic field grouping

Rejected because: Simple field splitting broke when fields had semantic dependencies such as customer and address fields.

“Our our previous heristic based approach, it's like, "Oh, just just chop them up into different field groups." Stopped working”transcript, stated

Treat confidence as a traditional ML score

Rejected because: Generative AI did not provide confidence scores in the same way old ML extraction systems did.

“generative AI doesn't have confidence scores like old ML models do. So we had to like start to do things like oh we'll”transcript, stated

Patterns

multi-agent-orchestration (agent-design)

Box separated document extraction into specialized sub-agents for grouping, extraction, and quality feedback.

“a series of sub aents whose job was to solve these kind of problems”transcript, stated

llm-as-judge (evaluation)

The workflow uses a model/judge-style quality loop to assess extracted fields and trigger retries.

“we'll run an element as a judge and it'll tell you after it's done if it thinks it was accurate or not.”transcript, stated

fallback-degradation (resilience)

When a field looks wrong, the system can retry using different techniques or model voting.

“let me try again. maybe I'll use different models to vote and to do other techniques.”transcript, stated

Tradeoffs

Architecture redesign

Chose multi-agent extraction workflow over incremental preprocessing fixes around one LLM call.

Rationale: The agentic abstraction separated failure modes and made future updates easier.

“a natural engineering response to this is like okay we'll pre-process more or we will uh uh you know solve each of those little problems”transcript, stated

Quality feedback design

Chose feedback loop with retries and model voting over one-shot extraction confidence.

Rationale: Generative AI lacked old-style confidence scores and needed iterative quality checks.

“we incorporated a quality feedback loop, not just to give you confidence, but then also to give feedback so that the AI could try uh different techniques.”transcript, stated

Gotchas (what bit them)

A simple LLM extraction pipeline failed under enterprise document complexity.

Root cause: Long documents, bad OCR, multilingual pages, hundreds of fields, and confidence expectations exposed separate failure modes.

Resolution: Rearchitect into specialized sub-agents and a quality feedback loop.

“then we started to hit the problems uh when we started tell our customers just give us any data”transcript, stated

Field grouping is semantic, not just mechanical chunking.

Root cause: Related fields like customer and address need to be extracted together for the LLM to preserve context.

Resolution: Use an agentic grouping step that learns which fields belong together.

“if you have client uh files, client uh customers of your contract and then customer addresses, those kind of need to go together”transcript, stated

Evaluation

Box evaluates extraction through quality feedback, judge-style checks, confidence-like signals, retries, and whether fields are extracted accurately enough for customer workflows.

Metrics: pages processed · field extraction accuracy · quality feedback · confidence-like judgment · retry success

“a quality feedback loop, not just to give you confidence, but then also to give feedback”transcript, implied

Outcomes

Box reports enterprise-scale usage with over 115,000 companies, tens of millions of users, over an exabyte of data, and an initial 10 million pages processed by the simple system.

“this really um sort of is the the key of what we learned here”transcript, stated