Inspiration
First-time cross-border trade runs on trust that nobody can verify. A buyer with no payment history asks for 30 or 60 days of credit; a seller is asked to ship half a million dollars of rebar to a stranger. A contract proves that both sides agreed, not that either will perform. Letters of credit are slow and bank-heavy, and nobody wires USD 1.8M to a first-time counterparty.
What a first-time buyer will do is pay a small, exact, verifiable amount — and let the evidence of that payment buy the next step. TrustLoop makes that the product: trust as a sequence of verified payments instead of a promise.
What it does
TrustLoop is a Deal Room for a first cross-border order.
- Deal intake: buyer, product, quantity, a CNY 1,825,000 contract, 30 days of credit requested.
- Evidence-backed contract review: every finding links back to a quoted line of the contract — no liquidated damages clause, no delivery schedule, no dispute resolution, a typo in the counterparty name.
- Agent proposal: a live LLM, or the deterministic planner when no key is configured, returns a structured AgentProposal — decision (PROCEED / REVIEW / BLOCK), rationale, the evidence it used, and the tools it requests.
- Currency policy: the contract is in CNY and cross-border CNY is restricted on this PayPal path, so the agent proposes a supported invoice currency and records a timestamped FX snapshot with its source. The model is never allowed to invent a rate.
- Human approval: the operator approves one milestone at an exact amount and currency. No financial action happens without that record.
- PayPal execution: the agent then requests create_invoice and send_invoice, in that order, inside the approved envelope.
- Verified progression: the workflow advances only when PayPal reports PAID, and the paid amount and currency must match the approval exactly.
- Trust Passport: approvals, settlements, FX snapshots, agent evidence and the audit hash chain are packaged into a portable Passport that a public page can verify, with an HMAC-SHA256 issuer signature when configured.
- Evidence console: the same run projected into two AG Grid tables — milestones joined to approvals and PayPal invoices, and the audit hash chain itself — sortable, filterable and exportable.
Three milestones by default: sample fee (USD 500), trial order (USD 5,000), commodity deposit (USD 9,000). Each stage unlocks only after the previous one is verified as paid.
How we built it
Python 3.12 and Streamlit for the Deal Room, over a domain layer that does not depend on the UI.
- A deal state machine with deterministic transitions, idempotency and SQLite checkpoints, so an interrupted payment resumes without ever assuming success.
- An append-only audit log where every event carries the hash of the previous one; the head hash goes into the Passport, so an edited history stops verifying.
- Decimal-backed money with floats rejected at the boundary, zero-decimal currency handling, and PayPal in-country restrictions for CNY.
- PayPal REST: OAuth, invoice draft, send, status query. A real Sandbox invoice was created, sent, paid by a Sandbox personal account, and verified as PAID with the transaction id captured as evidence.
- A signed webhook endpoint that verifies the PayPal transmission signature and then re-queries PayPal before any state change.
- A policy engine: per-milestone USD ceiling, restricted tool registry, and a guard that an agent plan cannot escalate its own permissions. Contract text is treated as untrusted input, with a prompt-injection test matrix.
- Structured LLM planning with a deterministic fallback. The planner's evidence references are canonicalised back to the verbatim contract quote, and the ladder is clamped to the deployment's three-stage amount envelope: the model chooses the reasoning, never the sizes.
- Bring-your-own-model: a visitor can paste any OpenAI-compatible endpoint and key. The override lives only in that browser session's planner