Build Journey

How each agent was designed and built

SOX Audit Trail Active
Chapter 01

The Challenge

Opendoor processes thousands of transactions per month across home acquisitions, renovations, and operations — all requiring accurate GL coding, reconciliation, and policy compliance.

Where time was being lost

Manual GL coding
Accountants spend significant time during close week manually assigning account codes to transactions
PDF invoice matching
AP team cross-references invoice PDFs against PO records line-by-line — a time-consuming process prone to human error
Policy email volume
Finance team fields repetitive policy questions regularly — approval thresholds, payment terms, travel rules
QoQ variance explanations
Writing MD&A narratives for material variances is a labor-intensive process during each earnings cycle

Design principles

Human-in-the-loop
AI drafts, humans approve. Every action is logged with confidence score and timestamp.
SOX-ready audit trail
Immutable log of every AI decision, approval, and override. Ready for external auditors.
Configurable thresholds
Materiality, confidence, and escalation thresholds are defined in config — not hardcoded.
Chapter 02

Journal Entry Agent

GPT-4o Mini classifies transactions against a 57-account chart of accounts modeled from Opendoor's 10-K, generating debit/credit pairs with confidence scores and MD&A-ready explanations.

TransactionBuild PromptGPT-4o MiniParse JSONAudit Log

How it works

  1. 1Transaction arrives with vendor, amount, category, and description
  2. 2Agent builds a structured prompt including all 57 COA accounts with their types
  3. 3GPT-4o Mini returns a JSON object: debit account, credit account, confidence, explanation
  4. 4If confidence < 85% OR amount > $10,000 → flagged for human review
  5. 5Every classification is written to the audit log with timestamp

SOX controls

Confidence threshold:85% — below this, human review required
Materiality threshold:$10,000 — large amounts always reviewed
Dual-key control:AI drafts entry; human posts to GL
Audit trail:Every classification logged with model, confidence, input/output
In Production: NetSuite Integration
In production, the COA hierarchy would be fetched live from NetSuite via its REST API, ensuring the agent always uses the current account structure. Account segment validation (subsidiary, class, department) would be enforced before any GL posting. The human approval step maps directly to NetSuite's journal entry approval workflow.
AspectDemo (This Project)Production (Opendoor)
Chart of Accounts57 accounts from 10-K (SQLite)Live NetSuite COA via REST API or MCP, full segment hierarchy
AI ModelGPT-4o Mini (fast, cost-efficient)GPT-4o Mini — cost-efficient for high-volume classification
Review workflowApprove button in dashboardNetSuite journal entry approval workflow
Data volumeSynthetic transactions modelled from NetSuite exportLive transaction feed across all subsidiaries
Chapter 03

Reconciliation & Matching

A two-part agent: 3-pass bank↔GL reconciliation using fuzzy scoring, and AP invoice three-way match (invoice ↔ PO ↔ receipt). Realistic discrepancies injected at 5% to demonstrate exception handling.

Bank StmtsGL EntriesExact MatchFuzzy MatchExceptions

3-Pass Reconciliation

Pass 1: Exact
Amount matches within $0.01 AND date within 1 day
Pass 2: Fuzzy
Weighted score: 70% amount similarity + 30% date proximity. Threshold: 0.8
Pass 3: Unmatched
Remaining entries flagged as bank-only or GL-only exceptions

Invoice Three-Way Match

Match invoice against PO and receipt in two passes:

  1. PO# exact: Invoice PO number matches a known open PO
  2. Vendor+Amount fuzzy: Same vendor within ±$50 or ±0.5%
  3. Exceptions: Missing PO, amount mismatch, duplicate invoice
Synthetic discrepancies (SEED=45)
Amount mismatch: 3% · Missing PO: 2% · Duplicate: 3%
In Production: Gemini Embeddings 2 + Vision
For PDF invoice matching, production would use Gemini Embeddings 2 to create semantic embeddings of invoice line items, enabling fuzzy matching even when vendor names differ (e.g., "Amazon Web Services" vs "AWS Inc."). Gemini's multimodal capability would extract structured data directly from scanned PDFs — handling handwritten amounts, rotated documents, and multi-currency invoices.
AspectDemo (This Project)Production (Opendoor)
Invoice inputStructured fields from SQLite, styled as Deel payment recordsPDF extraction via Gemini Vision API
Fuzzy matchingAmount + date weighted scoreGemini Embeddings 2 cosine similarity on line items
Data sourceSynthetic bank (Ramp-style) + GL (NetSuite-style) entriesRamp API (banking/cards) + NetSuite GL export
Exception workflowDashboard review panelJira ticket auto-created for exceptions
Chapter 04

Flux Analysis

Quarter-over-quarter variance analysis across 21 financial statement line items sourced from Opendoor's SEC filings. Material variances trigger GPT-4o to generate MD&A-ready narratives.

Prior PeriodCurrent PeriodCompute ΔFlag MaterialGenerate MD&A
$10,000
Dollar threshold
Variance must exceed this amount
5%
Percent threshold
AND this percentage change
GPT-4o
Narrative model
MD&A quality language generation

Synthetic material variances (from Opendoor 10-K patterns)

-15%
Revenue
Reduced transaction volume, market slowdown
+35%
Marketing & advertising
Increased performance marketing spend
+35%
Cloud infrastructure
AI/ML workload scale-up
+50%
Inventory valuation adj.
Market value write-down on held homes
In Production: Snowflake + dbt
In production, financial statement data would live in Snowflake with dbt models transforming raw GL data into period-comparison marts. The flux agent would query these marts via Snowflake's Python connector, and narratives would be auto-appended to the quarterly earnings report template in Google Docs or PowerPoint — significantly reducing narrative preparation time.
AspectDemo (This Project)Production (Opendoor)
Data source4 quarters (Q1-Q4 2025) from Opendoor SEC filingsSnowflake dbt-transformed financial mart
Narrative generationGPT-4o on-demand per material itemBatch job night before earnings call
Output formatJSON API + dashboard displayAuto-appended to 10-Q MD&A template
ThresholdsConfigurable in config.pySet by Controller in YAML per entity
Chapter 05

Policy Agent

A two-part agent: real-time policy Q&A with SSE streaming, and inbound email triage that classifies emails and auto-drafts responses for all classified emails with ≥50% confidence.

Policy DocsChunk + SearchGPT-4o MiniSSE StreamAudit Log

Knowledge Base

FIN-001 Expense Policy
$500/$5K/$25K/$100K approval thresholds
FIN-002 AP Procedures
Three-way match, Net 30/45/60 terms
FIN-003 Travel Policy
Navan booking, air class, hotel rate limits
FIN-004 Vendor Management
W-9, insurance, conflict of interest
FIN-005 Close Procedures
Month-end timeline, SOX key controls

Email Triage Logic

policyAuto-draft response using policy Q&A agent
vendorRoute to AP inbox — no auto-draft (needs system lookup)
escalationAlert finance manager immediately
otherTag and queue for human review
SSE Streaming: Policy chat uses client.chat.completions.create(stream=True) for real-time token streaming — the same pattern that makes ChatGPT feel responsive. Users see the answer form progressively, not all-at-once.
In Production: Gemini Embeddings 2 + Outlook API
Production would replace keyword search with Gemini Embeddings 2 cosine similarity — enabling semantic matching ("what counts as a business meal?" would still match expense policy). Email triage would integrate directly with Outlook via Microsoft Graph API, reading emails from the finance alias and automatically triaging with suggested routing. Draft responses would be created as Outlook drafts, ready for one-click send.
AspectDemo (This Project)Production (Opendoor)
Knowledge searchKeyword matching (TF-IDF style)Gemini Embeddings 2 cosine similarity
Email sourceText input in dashboardMicrosoft Graph API (Outlook inbox)
Draft deliveryDisplayed in UI panelCreated as Outlook draft, ready to send
Policy updatesMarkdown files, manual re-chunkCMS (Confluence/SharePoint), auto-indexed on change
Chapter 06

Platform Vision

Four agents are just the start. The same architecture scales to cover the full finance function — from procurement to close to reporting — with a phased adoption roadmap that keeps humans in control throughout.

Full production architecture

Data Layer
  • Snowflake (financial data)
  • NetSuite GL
  • Ramp (banking/cards)
  • Deel (contractor invoices)
  • SharePoint (policy docs)
AI Agents
  • Journal Entry (GPT-4o Mini)
  • Reconciliation (GPT-4o Mini)
  • Flux Analysis (GPT-4o)
  • Policy Chat (GPT-4o Mini)
Orchestration
  • FastAPI gateway
  • Audit log (PostgreSQL)
  • Human review queue
  • Notification webhooks
Integrations
  • Outlook (email triage)
  • Slack (alerts)
  • Jira (exception tickets)
  • Tableau (reporting)

Projected impact

Significant
Reduction in manual GL coding time
Higher
Invoice match rate vs. manual process
Faster
MD&A narrative preparation
Minimal
Time spent answering policy email FAQs
In Production: Agentic Workflow (2026+)
The next evolution is full agentic close: the system monitors the close calendar, automatically triggers reconciliation at month-end, escalates exceptions via Slack, and generates a draft CFO reporting package — all without human initiation. Humans shift from executing the close to reviewing it.