- A file upload UI that accepts multiple documents
- A document classification workflow that identifies each document type using AI
- A fan-out extraction pipeline that routes each type to a specialized extractor
- An AI reconciliation step that compares extracted data against application data
- Business rules that flag mismatches (name, address, income)
- A human review task for documents with discrepancies
- A summary generation step that produces a verification report
Architecture overview
The pipeline processes documents in four phases: upload, classify and extract, reconcile, and review. Workflow breakdown:| Workflow | AI nodes | Purpose |
|---|---|---|
classifyAndExtract | Text Understanding + Extract Data from File | Classify document type, then extract fields using type-specific prompts |
reconcileData | Text Understanding | Compare extracted fields against application data |
generateSummary | Text Generation | Produce a human-readable verification report |
Prerequisites
Before starting, make sure you have:- Access to a FlowX Designer workspace with AI Platform enabled
- Familiarity with creating processes, workflows, and UI flows in FlowX
- A project with the Documents Plugin configured (for file uploads)
Data model
Define the following data model keys in your process. These keys hold the application data submitted by the customer and the results produced by the AI pipeline.Step 1: Build the classification and extraction workflow
Create a workflow namedclassifyAndExtract. This workflow receives a single document file path, classifies the document type, and then routes to the appropriate extraction branch.
This implements the fan-out extraction pattern.
1.1 Add the classification node
Add a Text Understanding node as the first node after Start Flow. This node reads the document content and classifies it. Operation Prompt:classificationResult
1.2 Add the Condition node
Add a Condition node after the Text Understanding node. Configure branches based on thedocument_type value:
| Branch | Condition (Python) | Target |
|---|---|---|
| If | input["classificationResult"]["document_type"] == "ID_CARD" | Extract Data from File (ID card) |
| Else if | input["classificationResult"]["document_type"] == "PROOF_OF_ADDRESS" | Extract Data from File (proof of address) |
| Else if | input["classificationResult"]["document_type"] == "SALARY_SLIP" | Extract Data from File (salary slip) |
| Else | (default) | Script node (unknown document) |
The Else branch handles
UNKNOWN documents. Use a Script node to return a structured error so the parent process can flag the document for manual classification.1.3 Configure type-specific extraction nodes
Each branch contains an Extract Data from File node with a prompt and schema tailored to that document type.- ID card
- Proof of address
- Salary slip
Extraction Strategy: LLM Model (handles varied ID layouts, photos, and security features)Operation Prompt:Response schema:Response Key:
extractedData1.4 Add the End Flow node
Add an End Flow node where all branches converge. Set the body to pass results back to the parent process:Step 2: Build the reconciliation workflow
Create a workflow namedreconcileData. This workflow compares the extracted document data against the applicant’s declared data.
This implements the AI comparison and reconciliation pattern.
2.1 Add the comparison node
Add a Text Understanding node that receives both the extracted data and the application data. Operation Prompt:reconciliationResult
2.2 Add the End Flow node
Step 3: Build the summary generation workflow
Create a workflow namedgenerateSummary with a single Text Generation node.
Operation Prompt:
summaryReport
End Flow body:
Step 4: Build the BPMN process
Create a process nameddocumentVerify that orchestrates the full pipeline using the workflows you built.
Add a User Task for file upload
Add a User Task node after the Start Event. This task presents the file upload UI to the user.Configure the task with:
- Task name:
Upload documents - Assignment: Assigned to the initiating user
Loop through uploaded documents
For each uploaded document, trigger the Add a Receive Message Task node to capture the extraction output. Set the Result Key to
classifyAndExtract workflow. Add a Send Message Task node with a Start Integration Workflow action.Input mapping:extraction.classifiedDocs[index].For multiple documents, repeat the Send/Receive pattern for each file, or use a loop structure with an exclusive gateway that iterates until all files are processed.
Trigger the reconciliation workflow
Add another Send Message Task with a Start Integration Workflow action pointing to the Add a Receive Message Task node. Set the Result Key to
reconcileData workflow.Input mapping:reconciliation.Add a business rule for validation
Add a Business Rule action (JavaScript) to perform deterministic validation checks that supplement the AI reconciliation.
Add the routing gateway
Add an Exclusive Gateway after the business rule. Configure two branches:
| Branch | Condition | Target |
|---|---|---|
| Auto-approve | validation.requiresReview == false AND reconciliation.matchRate >= 90 | Proceed to summary generation |
| Human review | (default) | Human review User Task |
Add the human review task
Add a User Task node for manual review. The reviewer sees:
- Uploaded documents (viewable in a document viewer)
- Extracted data side-by-side with declared data
- The exception report from reconciliation
- Validation flags from the business rule
- Approve — continue to summary
- Reject — end process with rejection status
- Request re-upload — loop back to the upload step
review.reviewerDecision and any notes in review.reviewerNotes.Trigger the summary generation workflow
After both the auto-approve and human-review-approve paths converge, add a Send Message Task to trigger the Add a Receive Message Task. Set the Result Key to
generateSummary workflow.Input mapping:summary.Step 5: Build the upload UI
Create a UI Flow with a page for document upload.Create the UI Flow
Go to UI Flows in the project sidebar and create a new UI Flow named
documentUpload.Add an upload component
Add a File Upload component to the page. Configure it to:
- Accept multiple files
- Restrict file types to PDF, JPG, PNG
- Map uploaded file paths to
documents.uploadedFiles
Add applicant data display
Add form fields (read-only) that display the applicant’s declared data from
applicant. This gives context to the person uploading documents.For the human review step, create a second UI Flow page that displays the extracted data, reconciliation results, and exception report alongside the original documents. Use a side-by-side layout so the reviewer can compare easily.
Step 6: Build the review UI
Create a second page in the UI Flow for the human review task. The review page should include:| Section | Data source | Component |
|---|---|---|
| Applicant info | applicant | Read-only form fields |
| Uploaded documents | documents.uploadedFiles | Document viewer |
| Extraction results | extraction.classifiedDocs | Data table |
| Reconciliation report | reconciliation.fieldResults | Data table with status badges |
| Exceptions | reconciliation.exceptions | List with severity highlighting |
| Validation flags | validation | Alert components for each flag |
| Decision | review.reviewerDecision | Radio buttons (Approve / Reject / Request re-upload) |
| Notes | review.reviewerNotes | Text area |
Testing
Test classification in isolation
Open the
classifyAndExtract workflow and use Run Workflow with a test file. Upload sample documents one at a time and verify the classification output.| Test document | Expected type | Expected confidence |
|---|---|---|
| Scanned passport | ID_CARD | > 0.9 |
| Electricity bill PDF | PROOF_OF_ADDRESS | > 0.9 |
| Monthly payslip | SALARY_SLIP | > 0.9 |
| Random brochure | UNKNOWN | < 0.5 |
Test extraction accuracy
For each document type, compare the extracted fields against the actual document content. Check that:
- Names are captured correctly (including accented characters)
- Dates are in the expected
YYYY-MM-DDformat - Numeric values (salary, postal code) are accurate
- Null is returned for missing fields (not hallucinated values)
Test reconciliation with known mismatches
Prepare test data with deliberate mismatches:Upload an ID card with the name “Jonathan Smith” and a salary slip showing a net salary of 4200. Verify the reconciliation output flags:
- Name variation as
WARNING - Income discrepancy (16%) as
WARNING
Test the business rule
Verify the JavaScript business rule catches:
- Expired ID documents
- Missing required document types
- Income discrepancy above 10%
- CRITICAL exceptions from reconciliation
Test the full end-to-end flow
Run the complete
documentVerify process:- Upload three documents (ID, proof of address, salary slip)
- Verify classification and extraction complete
- Check the reconciliation report
- If routed to review, complete the reviewer task
- Verify the summary report is generated
What you learned
In this tutorial, you built a document processing pipeline that demonstrates several key patterns:- Fan-out extraction — classifying documents by type and routing each to a specialized extraction node with tailored prompts and schemas
- AI reconciliation — comparing AI-extracted data against application data with structured exception reports
- Hybrid AI + business rules — combining AI-driven comparison with deterministic validation (expired documents, missing types, income thresholds)
- Human-in-the-loop — routing edge cases to a reviewer while auto-approving clean results
- Workflow composition — building modular workflows for classification, reconciliation, and summary generation, then orchestrating them from a BPMN process
Next steps
Fan-out extraction pattern
Scale the classification and extraction pattern to dozens of document types
AI comparison and reconciliation
Deep-dive into the reconciliation pattern with threshold tuning
Extract Data from File
Configure extraction strategies, image extraction, and signature detection
AI node types
Reference for all AI node types available in Agent Builder

