Skip to content

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
Stack
LLM extraction, Microsoft Graph, OneDrive, Queues, TypeScript
A laptop showing a supply agreement next to the fields extracted from it, with printed pages and a pen on the table.

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
  1. 1M365 mailboxes to IngestionChange notification
  2. 2OneDrive folders to IngestionDelta query
  3. 3Ingestion to ClassifierQueue message · async
  4. 4Classifier to Structured extractionType-specific schema selected
  5. 5Structured extraction to Review queueValidated fields with confidence
  6. 6Review queue to E-signatureApproved: request signature
  7. 7Review queue to Reply draftsApproved: draft the reply
  8. 8Review queue to Audit logEvery decision, with reviewer
  9. 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.

  1. 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.

  2. 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.

  3. 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.

  1. AutomatedIngestMailbox or folder change
  2. AutomatedClassifyContract amendment
  3. AutomatedExtract4 fields, 1 below threshold
  4. ReviewerReviewRate change confirmed against source
  5. ReviewerApproveReviewer recorded
  6. ExecutionSignSignature requested
  7. ExecutionDraft replyWaiting in the sender's drafts

05Integration complexity

What each connection has to survive.

Integrations and their failure modes
SystemInterfaceWhat makes it hard
Microsoft GraphSubscriptions, delta queries, mail draftsSubscriptions expire, tokens rotate, and throttling responses need honoured back-off.
OneDriveDelta sync on watched foldersMoves, renames and re-uploads must not be mistaken for new documents.
Language modelsStructured output against JSON schemasOutput can be well-formed and still wrong, so confidence and source position are kept per field.

06Challenges solved

Problems we had to design around.

  1. 01

    One extraction error could become a signed document.

    No path from extraction to execution except an explicit approval by a named reviewer.

  2. 02

    Reviewers had to hunt for the clause behind each value.

    Each extracted field links to its highlighted passage in the original document.

  3. 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

Start a project

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

  1. 01A conversation with the engineers who would build it.
  2. 02A short written view of the problem and how we would approach it.
  3. 03A scoped proposal, if working together makes sense.