Machines read the documents. People make the decisions.
AI Document Automation
Intelligent ingestion, classification and extraction with a review step before anything is signed, sent or posted.
- Category
- AI & automation
- Industry
- Professional services
- Work type
- AI, Automation
- Service
- AI Solutions
- Stack
- LLM extraction, Microsoft Graph, OneDrive, Queues, TypeScript

01Context
A services business receiving contracts, amendments and supporting documents through shared Microsoft 365 mailboxes and OneDrive folders, where each document eventually needs a decision, a signature or a reply.
The business problem
Document-heavy work crossed inboxes, storage, review and signing. Automating those transitions without an approval boundary turns one extraction error into a business action.
What we built
Ingestion from Microsoft 365 mailboxes and OneDrive, classification and structured extraction, a review queue with source-highlighted fields, then signing and email drafting executed only after approval.
02System architecture
Systems, flows and the boundaries between them.
- Service
- System of record
- External system
- Gate
- Asynchronous
- 1M365 mailboxes to IngestionChange notification
- 2OneDrive folders to IngestionDelta query
- 3Ingestion to ClassifierQueue message · async
- 4Classifier to Structured extractionType-specific schema selected
- 5Structured extraction to Review queueValidated fields with confidence
- 6Review queue to E-signatureApproved: request signature
- 7Review queue to Reply draftsApproved: draft the reply
- 8Review queue to Audit logEvery decision, with reviewer
- 9Review queue to Structured extractionSent back with a note
Components: M365 mailboxes (External system, Graph subscriptions); OneDrive folders (External system, delta sync); Ingestion (Service, normalise · OCR · hash); Classifier (Service, type and route); Structured extraction (Service, LLM → JSON schema); Review queue (Approval or permission gate, source-highlighted); E-signature (External system, approved records only); Reply drafts (Service, Graph · on approval); Audit log (System of record, who · what · source).
Major capabilities
- Microsoft 365 ingestion
- Mailboxes and OneDrive folders followed through Graph subscriptions and delta sync.
- Classification and routing
- Each document typed and sent to the extraction schema for that type.
- Structured extraction
- Model output validated against a JSON schema, with a confidence per field.
- Review queue
- Fields shown beside the highlighted source passage; low-confidence values must be confirmed.
- Gated execution
- Signature requests and reply drafts created only from an approved record.
03Engineering approach
The decisions that shaped the system.
We split the system into two halves with a hard line between them. Everything before the line analyses and proposes; nothing there can change the outside world. Everything after the line acts, and it only accepts approved records.
- 01
Separate analysis from execution.
The extraction side has no credentials to sign or send. Only an approval creates the record the execution side will act on.
- 02
Structured outputs, never free text.
Each document type has a schema. Output that fails validation is routed to a person rather than repaired by guesswork.
- 03
Event-driven steps with safe retries.
Each step reads and writes explicit state, so a failed call is retried or resumed without repeating work that already succeeded.
04Workflow
Review flow
Who acts at each step. The reviewer is the only path from analysis to execution.
- AutomatedIngestMailbox or folder change
- AutomatedClassifyContract amendment
- AutomatedExtract4 fields, 1 below threshold
- ReviewerReviewRate change confirmed against source
- ReviewerApproveReviewer recorded
- ExecutionSignSignature requested
- ExecutionDraft replyWaiting in the sender's drafts
05Integration complexity
What each connection has to survive.
| System | Interface | What makes it hard |
|---|---|---|
| Microsoft Graph | Subscriptions, delta queries, mail drafts | Subscriptions expire, tokens rotate, and throttling responses need honoured back-off. |
| OneDrive | Delta sync on watched folders | Moves, renames and re-uploads must not be mistaken for new documents. |
| Language models | Structured output against JSON schemas | Output can be well-formed and still wrong, so confidence and source position are kept per field. |
06Challenges solved
Problems we had to design around.
- 01
One extraction error could become a signed document.
No path from extraction to execution except an explicit approval by a named reviewer.
- 02
Reviewers had to hunt for the clause behind each value.
Each extracted field links to its highlighted passage in the original document.
- 03
Partial failures left work half done.
Explicit state per step, so retries resume from the last successful step.
07Outcomes
Analysis is automated and decisions stay human. Each action carries its source document, its reviewer and its state, so failures are recoverable and auditable.
Outcomes are described at capability level. Client figures stay with the client.
- Reading, classifying and extracting run without manual handling.
- Nothing is signed or sent without a recorded human approval.
- Any action can be traced to its source document, its reviewer and its state.
Relevant services
Bring us the process everyone works around.
The spreadsheet that runs the business, the inbox nobody can leave, the integration that breaks quietly. Tell us where operations slow down and we will show you how we would engineer it.
What happens next
- 01A conversation with the engineers who would build it.
- 02A short written view of the problem and how we would approach it.
- 03A scoped proposal, if working together makes sense.