Inspiration
On August 29, 2025, the United States suspended the \$800 duty-free de minimis exemption on international consumer parcels, with federal statutes finalizing permanent elimination. Virtually overnight, every single parcel arriving in the United States from abroad owes customs import duty.
This created an invisible crisis for millions of micro-artisans in the Global South. When a solo textile maker in Jaipur sells a handmade scarf to a buyer in New York over an Instagram direct message or WhatsApp chat, the buyer gets hit with an unexpected \$12 customs duty bill at their front door. The buyer refuses the parcel, and the artisan pays the exorbitant international return shipping fee, wiping out their margin.
Large multinational marketplaces have enterprise compliance teams to calculate Delivered Duty Paid (DDP) logistics. Solo makers have nothing. Furthermore, in India, Reserve Bank of India (RBI) regulations mandate that PayPal India accounts can process international export payments only. Exporting is the honest, vital gateway to global livelihood.
We built Film-to-Export to put an autonomous, agentic customs broker directly into every artisan’s pocket.
What it does
Film-to-Export turns a video of a maker’s workbench into compliant, cross-border commerce in under 60 seconds:
- Multimodal Workbench Perception: The artisan films a short pan across her table and speaks in Hindi or English (e.g., "This is a pure cotton block-printed scarf from Jaipur, ₹2,500").
- Deterministic Agent Stream: A streaming broker agent coordinates multimodal perception, voice transcription, live regulatory cross-referencing, and pricing over Server-Sent Events (SSE).
- Official USITC Tariff Grounding (Zero Hallucination): Instead of hallucinating tariff schedules from model memory, the agent queries the official US International Trade Commission (USITC) HTS REST API in real time.
- Agentic Self-Correction: When Gemini initially suggests heading
6214.20(wool), it cross-references the official government hierarchy against the maker's actual cotton materials and self-corrects to6214.90.00. - Restricted Materials Screening: Evaluates descriptions against international wildlife, CITES, and export-control watchlists (flagging ivory, shahtoosh, or red sanders).
- Delivered Duty Paid (DDP) PayPal Checkout: Computes the exact US import duty and generates a standalone, chat-ready PayPal pay link (
/pay/:itemId) isolating duty cleanly in PayPal Orders v2tax_total. - Server-Side Verification & Commercial Invoice: Captures and verifies the transaction server-to-server with PayPal, automatically generating a compliant DDP Commercial Invoice PDF taped directly to the shipping box.
- Enterprise Seller Ledger with AG Grid: Gives the seller a real-time order ledger with column filtering, live capture checks, and instant invoice downloads powered by AG Grid.
How we built it
Film-to-Export is engineered with a strict production-first architecture:
- AI & Multimodal Understanding: Google Gemini 2.5 Flash handles video frame extraction, Devanagari Hindi transcription, English translation, and attribute extraction in an optimized, single-pass pipeline.
- Autonomous Agent Orchestration: Built in deterministic TypeScript. Tool calls for classification, tariff queries, duty calculations, and sanctions screening stream state live via Server-Sent Events (SSE).
- Government API Integration: The USITC HTS REST API (
hts.usitc.gov) provides live tariff lines, duty rates, and hierarchical parent-child category context, backed by an offline cited fallback table. - Payments & DDP Compliance: Powered by PayPal Orders v2 REST API. Because PayPal lacks a dedicated customs duty field, we cleanly map customs duty into
tax_totaland line-item taxes, preserving the strict invariant:
$$ \text{total} = \text{item_total} + \text{tax_total} $$
- Data Grid & Analytics: Integrated AG Grid Community (v36) to render an enterprise-grade seller ledger with multi-column sorting, status pills, and direct PDF downloads.
- Persistent Cloud Architecture: Deployed live on Render, backed by a serverless Neon PostgreSQL database with an in-database binary media table (
BYTEA) ensuring uploaded frames and listings survive ephemeral cloud restarts. - Developer API Testing: Designed and verified with a comprehensive Postman Collection covering all endpoints from health checks to PayPal order captures.
- Automated Test Suite: 85+ Vitest automated tests covering duty formulas, PayPal breakdown invariants, and regulatory screening.
Challenges we ran into
- Models misclassify by material: Live, Gemini filed a cotton scarf under "wool" and, with truncated descriptions, a blue-pottery bowl under brown-glazed earthenware. Fix: read the whole official heading, give the model the full hierarchical descriptions, and accept only listed lines.
- We were wrong too: An official-API check caught two rates we'd copied from secondary sites, and the full hierarchy later showed a "Free" brass line was actually chain. Every rate in the fallback table is now verified against
hts.usitc.gov, with a dated note. - Ephemeral cloud files on free hosting: On Render, extracted video frames are stored on ephemeral disk that gets wiped on redeploy. We built a persistent
media_filestable in Neon PostgreSQL (BYTEA) so that images uploaded by makers survive continuous deployments. - Tariffs moved under our feet: The Supreme Court struck down the IEEPA tariffs in Feb 2026, but de minimis stayed suspended. The extra rate on Indian goods is still in flux, so it's a separate, flagged component.
- PayPal Sandbox realities: India-to-India payments are blocked (use a US buyer), and IN merchants can see
PENDINGcaptures, which we model aspayment_pending.
Accomplishments that we're proud of
- A live end-to-end agent: Hindi video → transcript → official US tariff lines → duties-included PayPal link → verified Sandbox payment → DDP invoice PDF.
- Zero-hallucination compliance: Grounding the agent in the live USITC HTS REST API so that tariff classifications and duty calculations reflect real-world US government law.
- PayPal Orders v2 compliance: Cleanly isolating estimated customs duty inside PayPal's
amount.breakdown.tax_totalwhile maintaining strict penny-level mathematical parity across line items. - Self-correcting agent intelligence: The agent catches and visibly explains its own classification mistakes against government hierarchy (e.g.,
6214.20wool →6214.90.00cotton). - Enterprise seller ledger: Seamlessly integrating AG Grid Community (v36) to give solo makers an interactive, sortable, filterable order book and instant commercial invoice downloads.
What we learned
- Grounding AI agents in authoritative government data is essential: Large models hallucinate tariff codes when relying solely on memory. By querying the live USITC REST API for the full heading and then having Gemini pick exclusively from the official lines, the agent eliminated hallucinated duties and successfully self-corrected classifications.
- PayPal Orders v2 requires strict amount breakdowns: Since PayPal lacks a dedicated duty field, packing duties into
tax_totalwhile matching line-item totals is the cleanest compliant way to present Delivered Duty Paid (DDP) pricing to international buyers without surprise fees. - Persistent storage for agent media: In cloud environments like Render with ephemeral disks, storing multimodal perception outputs directly in managed PostgreSQL (
BYTEA) guarantees that generated visual assets survive continuous deployments. - Enterprise data management with AG Grid: Presenting real-time cross-border order states, payment statuses, and generated invoice links in an interactive AG Grid table gave the seller an instant, professional dashboard.
What's next for Film-to-Export
- Multi-Country Support: Expanding official tariff schedules beyond the US to the EU (TARIC), UK (HMRC), and Canada (CBSA).
- PayPal Partner Onboarding: Implementing multi-tenant seller onboarding via PayPal Commerce Platform so any artisan worldwide can connect their own PayPal wallet with one click.
- Carrier Label Generation: Direct integrations with DHL Express and India Post to bundle the generated DDP Commercial Invoice directly with pre-printed airway bills.
Built With
- ag-grid
- agentic-ai
- cross-border
- ddp
- ecommerce
- express.js
- gemini
- google-gemini
- neon
- node.js
- paypal
- paypal-orders-v2
- pdfkit
- postgresql
- postman
- react
- render
- rest-api
- sse
- typescript
- usitc-api
- vite
- vitest