Architecture v0.2

Charles Dana · Monce AI · April 2026

Request flow

                  HTTPS
                    │
          ┌─────────▼─────────┐
          │   Route53 A       │   saft.aws.monce.ai → 35.180.91.48
          └─────────┬─────────┘
                    │
          ┌─────────▼─────────┐
          │   nginx (443)     │   Let's Encrypt TLS, reverse proxy
          └─────────┬─────────┘
                    │  127.0.0.1:8000
          ┌─────────▼─────────┐
          │  uvicorn/FastAPI  │   systemd: saft.service
          │  api/app.py       │
          └─────────┬─────────┘
                    │
          ┌─────────▼─────────┐       ┌─────────────────────┐
          │  Pipeline (7 st)  │──────▶│  AWS Bedrock        │
          │  stages 0..6+4.5  │       │  eu-west-3          │
          └─────────┬─────────┘       │  Haiku 4.5          │
                    │                 │  Sonnet 4.6         │
                    │                 └─────────────────────┘
                    │
          ┌─────────▼─────────┐
          │  Snake v5.4.5     │   pure Python, in-process
          │  SAT classifier   │   3 models in data/models/
          └───────────────────┘

Pipeline stages

#StageCostTypical timeOutput
0Client IDregex + 1 Haiku call< 1 scustomer_id, PO#, layout family
1Doc Analyzerregex + 1 Haiku call< 1 spage triage, layout (Ariba / Satair / direct)
2Unified Extractor1 Sonnet call per 3-page chunk3–6 sstructured JSON (mfr_pn, customer_pn, desc, qty, unit, price)
3Rules Enginedeterministic< 10 msschedule-line merge, subtotal check, ISO dates
4Snake Matcherin-process SAT< 10 ms/linematched SKU from 9,425-article basis
5Validation1 Haiku call1–2 sflags & overall confidence
6Routerdeterministic< 1 msauto-approve / review / full review

Data layout

data/
 ├─ articles.json         9,425 SKUs — the Saft Valdosta master data
 │                        (number, material_id, description) from OM-Material.csv
 ├─ clients.json          ~25 customers — Verizon, Satair, Airbus, military primes,
 │                        European rail, direct-ship accounts
 ├─ saft_entities.json    1 entity — SAFT AMERICA INC, Valdosta GA
 └─ models/
    ├─ article_matcher.json    9,425-label Snake, L=15, bucket=250
    ├─ client_matcher.json
    └─ entity_matcher.json

Deployment topology

LayerSpec
EC2t3.medium, Ubuntu 24.04, 20 GB gp3, eu-west-3
IAMinstance profile saft-po-profile → Bedrock InvokeModel
AuthAWS_BEARER_TOKEN_BEDROCK env in systemd unit
Nginx443 TLS (Let's Encrypt) → 127.0.0.1:8000
Servicesaft.service, auto-restart, 3 worker coroutines
DNSRoute53 zone aws.monce.ai, A-record TTL 300
Certcertbot renewal cron, valid until 2026-07-21

Extensibility