Case Description Efficient Capital Labs, a cross-border revenue-based financing (RBF) platform serving SaaS and AI companies across US, India, and Singapore, partnered with a21.ai to build “Nanodoc” — an agentic AI underwriting automation platform on AWS Bedrock. The system automates document classification, bank statement spreading, financial stat
Efficient Capital Labs — Agentic AI Underwriting for Cross-Border RBF Case Description: Efficient Capital Labs (ECL) is a cross-border revenue-based financing platform serving SaaS and AI companies across the US, India, and Singapore. They partnered with a21.ai to build "Nanodoc" — an agentic AI underwriting automation platform on AWS Bedrock. The system automates document classification, bank statement spreading, financial statement extraction, and risk analysis using multi-agent pipelines with self-correcting evaluation loops, replacing manual processes that consumed over 80% of underwriter time. Problem Statement: ECL provides non-dilutive, revenue-based financing to cross-border SaaS and AI companies with a typical loan size of approximately $300K. Their average customer operates across 3 countries with 3 separate legal entities. ECL's underwriting process was severely bottlenecked by manual operations across five dimensions: 1. Overwhelming document volume: Each loan application generates 120+ PDF bank statements (10 accounts x 12 months), plus financial statements, tax returns (US 1120, India ITR/GST), contracts, and KYC documents. Documents arrived scattered across Google Drive, emails, and their Bubble application portal with no single source of truth. 2. Manual PDF extraction with high error rates: Bank statements (especially Indian bank formats) required manual conversion from PDF to Excel. ECL outsourced to vendors using Docsumo/Sensible, but error rates were unacceptably high for lending decisions. Skilled underwriters spent 80%+ of their time on menial data collection, document classification, and validation tasks instead of judgment-intensive credit decisions. 3. Risk engine underutilization: ECL's existing automated risk decisioning engine could only process approximately 20% of cases — those with structured API data from Plaid/Teller. The remaining 80% required manual extraction from unstructured PDFs before the engine could score them, creating a critical bottleneck. 4. Multi-jurisdiction complexity: Non-uniform data standards across US, India, and Singapore: different bank statement formats, tax document types, regulatory requirements, and currency conventions. No single extraction model could handle the variance. 5. Inability to scale profitably: The manual cost per loan made it uneconomical to service smaller loan amounts or grow the portfolio without linear headcount growth, undermining ECL's unit economics at scale. Proposed Solution & Architecture: a21.ai built "Nanodoc" — a multi-agent GenAI underwriting automation platform deployed on AWS. Infrastructure & Hosting: - Amazon ECS (Docker containers) hosting the application stack: Django API layer + Celery async task workers + Redis message broker, deployed in ECL's AWS environment. - Amazon API Gateway: customer-facing API management for document submission and query endpoints. - Amazon S3: single source of truth for all document storage (raw uploads, extraction artifacts, bounding-box coordinates, quality scores), replacing scattered Google Drive storage. - Amazon CloudWatch: logging, monitoring, and alerting across all pipeline stages. Core AI Pipeline on Amazon Bedrock: All LLM inference runs on Amazon Bedrock: - Anthropic Claude Opus: Primary model for document classification, bank statement extraction, financial statement spreading, and risk analysis. - Anthropic Claude Sonnet: Cost-optimized evaluation/auditing agent providing independent verification of classification and extraction outputs. - Amazon Bedrock Titan v2 Embeddings: Document chunk vectorization for semantic search in the Underwriter Copilot. Agent 1 — Document Classification System: Two-agent architecture with independent verification: 1. Classifier Agent: classifies uploaded documents into predefined categories (Bank Statement US, Bank Statement India, Financial Statement, Contract, KYC, Tax Return, etc.) 2. Evaluator Agent: independently audits classifier output, flags disagreements, triggers re-classification when confidence is low. Additional: Semantic search using vector embeddings in Amazon OpenSearch Service. Self-improving model via feedback mechanism: misclassifications captured and injected as dynamic few-shot examples into future prompts. Agent 2 — Bank Statement Spreading (PDF Extraction): LangGraph-based agent system for automated extraction from PDF bank statements: - Hybrid text extraction: PyMuPDF for text-rich (native) pages; AWS Textract for scanned/image-heavy pages. - Intelligent image preprocessing: quality assessment, conditional corrections (upscaling, CLAHE contrast enhancement, denoising, deskewing) before Textract OCR. - Concurrent page processing: up to 10 pages processed in parallel via Celery workers. - Self-correcting extraction loop: evaluation agent scores each page; pages with 3+ failed transactions trigger re-extraction with targeted error feedback injected into the prompt. - Coordinate enrichment: bounding-box positions attached to each extracted field, enabling UI highlighting for human-in-the-loop verification. - Tally validation: automated balance checks (closing_balance = opening_balance + credits - debits) flag discrepancies. - Output: structured JSON with bank info, account info, transactions, balance summaries, and per-field quality scores stored in Amazon S3. Agent 3 — Financial Statement Spreading: Multi-stage pipeline for balance sheets, income statements, and US corporate tax returns (Form 1120): - AWS Textract (TABLES + FORMS + LAYOUT mode) for tabular and label-value document structures. - Pipeline stages: page classification, entity extraction, notes bifurcation, entity mapping, quality evaluation (all orchestrated via LangGraph). - Company-centric output transformation for downstream risk engine consumption. Agent 4 — Underwriter Copilot (QA Chatbot): LangGraph-based RAG agent enabling underwriters to ask natural-language questions about any document in a loan application: - Multi-document vector search via Amazon OpenSearch Service. - Thread-based conversation memory for multi-turn underwriting interrogation. - API-based interface with async processing via Celery; responses cite source documents with page references. Agent 5 — Independent Risk Analysis Engine: Autonomous multi-dimensional risk assessment framework: - 5 core pillars, 23 sub-dimensions, 60+ specific metrics. - Systematic document discovery, entity structure analysis, financial health evaluation, risk scoring. - Auto-generated risk assessment reports fed to ECL's existing risk decisioning engine, increasing its utilization from approximately 20% to 60%+. Shared Foundation — Raw Content Extraction & Vectorization: - Hybrid extraction: PyMuPDF (text-rich pages) vs AWS Textract OCR (scanned pages), routed dynamically based on per-page content analysis. - Supported formats: PDF, DOCX, DOC, PPTX, XLSX, XLS, CSV, PNG, JPG. - Vector embeddings in Amazon OpenSearch Service for semantic retrieval. Observability & Quality: - Amazon CloudWatch: centralized logging across all Lambda triggers and ECS tasks. - Amazon SNS: notification service with Slack integration for pipeline alerts and underwriter notifications. - Langfuse (self-hosted on ECS): full LLM trace observability, prompt-level scoring, evaluation datasets for regression testing. Project Outcomes and Success Metrics: - Underwriter throughput: 5-10x increase — skilled underwriters freed from menial data collection to focus on judgment-intensive credit decisions. - Risk engine utilization: increased from approximately 20% (structured API data only) to 60%+ (unstructured PDFs now automatically converted to structured inputs). - Bank statement extraction accuracy: approximately 96.7% correct transaction extraction rate with self-correcting evaluation loops. - Document classification: automated classification across 10+ document categories with independent evaluator agent verification. - Processing time: multi-day manual extraction per application reduced to hours via automated pipeline with concurrent page processing. - Data consistency: eliminated vendor-dependent extraction errors (Docsumo/Sensible) through in-house AI pipeline with tally-check validation. - Single source of truth: centralized S3-based document management replacing scattered Google Drive, emails, and Bubble portal. - Self-improving accuracy: feedback loops and dynamic prompt injection from past misclassifications continuously improve model performance without retraining. - Scalability unlocked: per-loan automation cost enables profitable servicing of smaller loan amounts, supporting portfolio growth without linear headcount.