Inspiration

In heavy industrial facilities—from municipal water treatment plants and petrochemical refineries to automated cold-storage logistics—unplanned machinery downtime bleeds global enterprise $260,000 every single hour (Siemens True Cost of Downtime Report). When a heavy slurry pump or industrial compressor suffers bearing fatigue, the legacy procurement lifecycle takes days of manual inspections, purchase requisitions, supplier quotes, and phone calls.

However, as Jamie Dimon (CEO, JPMorgan Chase) and industrial CISOs warned in 2024, unsupervised autonomous AI agents equipped with payment authority represent an existential financial risk. If an LLM hallucinating maintenance urgency is allowed to unilaterally dispatch wire transfers, rogue procurement agents could bleed corporate treasury or pay fraudulent vendors before physical work is ever executed.

We asked an uncompromising engineering question:

"Can an autonomous AI agent diagnose mission-critical machinery and initiate PayPal payments, while mathematically and cryptographically guaranteeing that zero dollars leave corporate custody until physical proof of repair is independently verified?"

This is why we engineered KinetixRAG.


What It Does

KinetixRAG is an evidence-gated autonomous machine commerce system that bridges real-time industrial IoT vibration physics with the PayPal Orders v2 platform and enterprise ERP general ledgers (Google Sheets, SAP S/4HANA, IBM Maximo).

Its architecture is anchored by a strict invariant: "No Physical Evidence, No Payment Capture".

  1. Multi-Source IoT Telemetry: Continuously monitors mechanical vibration via historical NASA IMS bearing run-to-failure benchmark datasets (outer-race defects at 20 kHz) and live smartphone MEMS accelerometers via HTML5 DeviceMotionEvent. Anomaly detection triggers when vibration crosses ISO 10816-3 Zone C/D limits (>4.50 mm/s RMS).
  2. Hybrid GraphRAG Diagnosis: A Neo4j knowledge graph traversing 36 equipment nodes, 8 failure modes, and OEM repair manuals identifies the mechanical root cause (outboard bearing spalling on Slurry Pump P-101A) with multi-hop citations.
  3. Autonomous PayPal RFQ & Two-Phase Authorization: The agent checks programmatic spending limits ($500 cap), solicits 3 competitive supplier bids, selects the optimal quote ($450), and creates a PayPal Orders v2 two-phase authorization hold (intent: "AUTHORIZE"). Funds are held in escrow, but zero money is paid to the vendor.
  4. The Cryptographic Evidence Gate (The Truth Barrier): If any premature script or rogue actor attempts to call capture before work is completed, the backend rejects the transaction with an HTTP 403 Forbidden. Funds are locked until:
    • A technician submits an on-site post-repair report matching the work order scope.
    • Fresh post-repair vibration telemetry demonstrates mechanical vibration has returned to ISO Zone A safe baseline (<2.30 mm/s RMS).
    • Dual-control Supervisor sign-off cryptographically fingerprints the evidence with SHA-256 into a binary Merkle audit tree.
  5. Settled Capture & Google Sheets ERP Clearing: Upon supervisor sign-off, PayPal captures the authorized hold, records the transaction hash with $O(\log N)$ inclusion proofs, and instantly clears the liability to a live Google Sheets ERP Ledger (2100-PAYPAL-CLEARING).

How We Built It

  • PayPal Platform Integration: Official PayPal Orders v2 REST API in Sandbox mode. Enforces two-phase escrow holds (POST /v2/checkout/orders with intent: "AUTHORIZE", authorization capture, and webhook event reconciliation with idempotency tracking).
  • Frontend Cockpit: Next.js 16 (App Router), React 19, TypeScript, and Tailwind CSS. Features a 60 Hz WebGL oscilloscope, dynamic QR-code mobile pairing for live phone sensor streaming, and financial audit drawers.
  • Backend Architecture: High-throughput Python FastAPI engine, SQLAlchemy ORM, SQLite/PostgreSQL persistence, and Pydantic v2 boundary validators.
  • Knowledge Graph & AI Models: Neo4j graph database storing multi-hop asset topologies, powered by Groq (Llama 3.3 70B Versatile) and Google Gemini (Gemini 2.0 Flash) evaluated with RAGAS benchmarks.
  • Database & Cloud Services: Neon Lakebase Postgres (AWS us-east-2) providing cloud persistence.
  • Enterprise ERP Clearing: Live two-way integration with a Google Sheets ERP Ledger via Google Apps Script Web App, plus native connectors for SAP S/4HANA (PM01 Maintenance Orders) and IBM Maximo (OSLC REST).
  • Deployment: Vercel (Edge Frontend) and Render (Containerized FastAPI Backend).

Challenges We Ran Into

  1. The Two-Phase Settlement Race Condition: Traditional e-commerce workflows execute immediate captures (intent: "CAPTURE"). Enforcing industrial escrow required implementing strict two-phase holds (intent: "AUTHORIZE"), managing expiration windows, and building server-side guards that reject premature capture attempts with HTTP 403.
  2. Preventing Agent Hallucinations in Financial Procurement: Autonomous agents frequently overpay or select misaligned suppliers when context is ambiguous. We countered this by introducing deterministic Spending Mandates ($500 cap, max 1 open authorization per asset) and embedding multi-hop GraphRAG citations into every RFQ evaluation.
  3. Secret Security & Zero-Leak Audits: When deploying integrations across distributed cloud environments (Vercel, Render, Neon, Google Apps Script), managing webhook secrets without leaking keys required writing a custom pre-submission scanner (scripts/secret_scan.py) that strictly passes 8/8 security checks with zero plain-text credential leaks across git history.
  4. Physical Telemetry Fidelity: Simulating industrial sensor failure without mocking was solved by loading historical 20 kHz run-to-failure vibration datasets from the NASA Prognostics Center of Excellence (IMS Bearing dataset), calibrated to the international ISO 10816-3 mechanical vibration standard.

Accomplishments That We're Proud Of

  • Cryptographic Evidence Gating: 100% of unverified capture attempts are rejected with HTTP 403. Not a single dollar can be captured prematurely.
  • Live Google Sheets Cloud ERP Ledger: Every authorized PayPal capture writes an immutable GL 2100 clearing row to a live Google Sheet in under 1.2 seconds, giving corporate controllers immediate financial visibility.
  • Multi-Source Vibration Cockpit: Users can test industrial failure either by replaying NASA IMS bearing run-to-failure datasets or by scanning a QR code with their own smartphone and physically shaking the phone to trigger live MEMS sensor spikes!
  • Exhaustive Automated Verification:
    • 8/8 Pre-submission Secret & Credential Scans (test_secret_scan.py)
    • 14/14 ERP & Ledger Hardening Specs (test_erp_connectors.py)
    • 82/82 Frontend Unit & Integration Specs (Vitest)
    • 17/17 Next.js production routes cleanly compiled.

What We Learned

  • Financial Safety Must Be Enforced by Code, Not Prompts: You cannot rely on prompt engineering to prevent an LLM from spending money. Spending limits, evidence verification gates, and dual-control sign-offs must live in deterministic, immutable server-side code.
  • PayPal Orders v2 Two-Phase Authorization is the Gold Standard for AI Commerce: The authorize-then-capture primitive provides the exact legal and operational boundary required for autonomous agentic commerce in enterprise settings.
  • Enterprise GraphRAG Outperforms Flat Vector Search: When diagnosing complex industrial equipment, traversing explicit relationships (Asset $\rightarrow$ Component $\rightarrow$ Failure Mode $\rightarrow$ Corrective Work Order) prevents the hallucinations that plague raw vector lookups.

What's Next for KinetixRAG

  • Autonomous Multi-Vendor B2B RFQ Bidding: Expanding the RFQ engine from synthetic supplier quotes to live B2B marketplace APIs with automated price negotiation based on historical parts catalogs.
  • Hardware IoT Microcontroller Gateways: Packaging the vibration collection daemon into ESP32 and Raspberry Pi industrial gateways running directly on factory floor MODBUS/RS485 networks.
  • PayPal Automated Payouts & Sub-merchant Routing: Transitioning from single merchant Sandbox captures to automated split payouts dividing service fees between parts suppliers and on-site certified field technicians.

Built With

Share this project:

Updates

Submission history