Inspiration
Industrial hardware failures rarely happen without warning—they begin as correlated drift across temperature, vibration, cooling fan speed, and electrical current. While modern AI models can diagnose faults and search catalogs, giving an autonomous agent unconstrained access to spend money is a major safety risk. We built SentinelPay to demonstrate safe agentic commerce: an AI operations agent that executes low-risk routine replacements autonomously via PayPal, while automatically escalating expensive or uncertain purchases for 1-click Human-in-the-Loop PayPal approval.
What it does
SentinelPay monitors an edge IoT hardware fleet (CNC-04, COLD-07, HVAC-02, PRINT-01) over a live 3-second telemetry stream:
- Multi-Signal AI Diagnosis (Gemini): Analyzes multi-point telemetry trends against each machine's operating baseline—not just static single-value thresholds—to identify the failing component, severity, urgency, and diagnostic confidence.
- Live Product Discovery (Channel3): Queries the Channel3 Product Search API (POST https://api.trychannel3.com/v1/search) using real-time InStock and severity-scoped price filters to find matching hardware parts across real merchants, then uses Gemini to select the best replacement SKU.
- Financial Policy Guardrail Engine: Evaluates every purchase proposal against configurable safety mandates: Per-Order Autonomous Cap (default $50) Daily Autonomous Spend Cap (default $150) Minimum AI Confidence Threshold (default 85%)
- Dual PayPal Sandbox Execution (@paypal/agent-toolkit + REST): Within Mandate (AUTO_PAYOUT): Executes a zero-click server-to-server PayPal Payouts v1 disbursement to the registered supplier/technician sandbox account. Exceeds Cap or Low Confidence (HITL_ORDER_APPROVAL): Creates a PayPal Orders v2 checkout order (PAYER_ACTION_REQUIRED), pauses for 1-click PayPal buyer approval, and automatically captures on return redirect (COMPLETED). Order Verification & Reconciliation: Integrates @paypal/agent-toolkit/ai-sdk (get_order, list_transactions).
- Enterprise Spend & Audit Ledger (AG Grid): Displays a sortable, filterable audit table tracking every AI diagnosis, confidence score, Channel3 catalog source, policy rule evaluation, and PayPal transaction status.
How we built it
Edge IoT Telemetry Stream (4 Industrial Nodes) │ ▼ Gemini Structured Reasoning (@google/genai) │ Multi-signal fault diagnosis + part ranking ▼ Channel3 Product Search API (/v1/search) │ Real InStock hardware listings + pricing ▼ SentinelPay Policy Guardrail Engine (Order Cap · Daily Cap · Confidence) ├── Within Mandate ──────▶ PayPal Payouts v1 (Autonomous Server-to-Server) └── Exceeds / Uncertain ─▶ PayPal Orders v2 (1-Click Human Approval + Auto-Capture) │ ▼ AG Grid Audit & Spend Ledger + Render Deployment
- Backend: TypeScript, Node.js, Express,
@paypal/agent-toolkit/ai-sdk, PayPal Sandbox REST APIs (Payouts v1 & Orders v2), and@google/genai(gemini-3.1-flash-litewith parallel fallback racing). - Catalog: Channel3 Product Search API (
https://api.trychannel3.com/v1/search). - Frontend: React, TypeScript, Vite, and AG Grid Community v33 (
ag-grid-react). - Hosting: Deployed via
render.yamlBlueprint on Render.
Challenges we ran into
- Headless Agent Payments vs. Buyer Consent: Standard PayPal Orders v2 cannot capture an order without buyer approval (
422 ORDER_NOT_APPROVED). We solved this by pairing PayPal Payouts v1 (server-to-server within autonomous policy caps using a US Sandbox Business/Personal pair) with Orders v2 for Human-in-the-Loop escalations. - Catalog Noise & Price Tiering: Broad product searches can surface unrelated manuals or consumer accessories. Applying
InStockand severity-scoped price filters (min_price/max_price) on Channel3 combined with LLM candidate filtering reliably matched industrial parts. - Telemetry State Contamination & LLM Spikes: Switching fault presets without resetting history contaminated the telemetry window, and free-tier LLM spikes caused
503/504timeouts. We solved both with clean baseline re-seeding on fault switches and parallel backup model racing with backoff retry.
Accomplishments that we're proud of
- Built a complete, live-deployed agentic commerce workflow verified end-to-end against real PayPal Sandbox Payouts, PayPal Checkout Orders, Channel3 API offers, and Gemini structured outputs.
- Implemented transparent, enforceable spending guardrails that prevent blind AI overspending while keeping low-risk procurement completely autonomous.
What we learned
- Designing agentic commerce requires explicit policy boundaries before payment APIs are ever invoked—knowing when not to auto-pay is just as important as automating checkout.
- Inspecting real API payload shapes early (
offers[0].price.priceon Channel3 and regional Sandbox Payout rules on PayPal) prevents brittle integrations.
What's next for SentinelPay
- Connect physical ESP32 / MQTT industrial sensor nodes in place of the simulated fleet stream.
- Add PayPal Vault v3 merchant-initiated stored-credential orders alongside Payouts.
- Listen to PayPal Sandbox webhooks (
PAYMENT.PAYOUTS-ITEM.SUCCEEDED) for instant real-time settlement updates in AG Grid.
Built With
- ag-grid
- channel3
- express.js
- gemini
- node.js
- paypal
- paypal-agent-toolkit
- react
- render
- typescript