Aegent — the agentic chat where buying is a conversation
Inspiration
Two things.
First, PayPal's own Agentic Commerce Protocol says the future of payments is an AI agent that can transact on your behalf. I kept hitting the same wall trying to use that pitch: every AI "shopping assistant" I'd seen treated the agent as a search box with a buy button, not a party in an actual conversation. On the other side, every chat app with payments bolted on treated the message thread as a reminder channel for a checkout that still lived on a web page. I wanted to collapse both — a chat where the agent sees the whole conversation, drafts the order right there, and the payment happens without the user ever leaving the thread.
Second, I'm Nigerian. Nearly every chat-commerce flow my friends and family actually use runs through Instagram DMs, WhatsApp statuses, and bank transfers — because the real sellers don't have the time or the legal paperwork to onboard with a payment processor. Any "agentic commerce" story that starts with "first, the seller signs up with Stripe" is already dead for the market I want to serve.
What it does
Aegent is an end-to-end encrypted messenger I've been building for a year. For this hackathon I added a Commerce Layer on top of it:
- Business profiles + catalogue. Any Aegent user can flip to a Business tab, create a profile, and list products with images, price, delivery info and description. Zero PayPal/Paystack onboarding needed for the seller — Aegent is the merchant of record.
- Discover feed with business ads. Public diary posts and business ads interleave in one feed. Tapping an ad opens a DM with the business, with the composer pre-filled by a quoted reference to the product.
- Per-chat agent, scoped to one business. The existing Æ icon still works inside a business DM, but the agent now answers "how much is X" or "do you have this in red" directly from that business's catalogue — and refuses to answer from general knowledge or another business's data.
- Anchored product card. When a product becomes the subject of the conversation, it pins to a small card under the chat header so the buyer doesn't lose it scrolling. The agent reads from it when drafting the order.
- Agentic checkout with Checkout PIN. The buyer says "I'll take it", the agent drafts an itemised order, a confirm card appears, and a dedicated 4–6 digit Checkout PIN (verified entirely on-device) gates the actual payment call. The PIN never touches the server or PayPal.
- Dual rails, currency-driven. PayPal handles USD/EUR/GBP/JPY/… Paystack handles NGN/GHS/ZAR/KES. The server picks the rail at order-create time; a seller in Lagos listing in Naira finally has a working checkout.
- Commission + payouts. Buyer pays full price via PayPal/Paystack; Aegent keeps a visible 5% commission; the rest accrues to the seller's Earnings view with a Request-payout button. Every number is visible.
- Vendor auto-notified. The moment the gateway captures, Aegent drops an itemised E2E message into the business owner's DM with the order summary. Same thread the buyer was in.
The agent doesn't act on anything. It drafts. The buyer confirms with PIN. The vendor hears about the sale in the same conversation.
How I built it
- Client: React 18 + Vite + TypeScript. Dexie (IndexedDB) for the encrypted local store. Framer Motion for animation. Packaged for Android via Capacitor 8.
- Server: Node 20 + Express + Socket.IO + Zod. JWT auth with rotating refresh tokens + an account-wide
security_versionclaim so recovery and sign-out-everywhere actually evict stale access tokens. SQLite locally, Neon Postgres in production. - Crypto:
tweetnacl(Curve25519 + XSalsa20-Poly1305) for every message payload and media blob. Argon2id viahash-wasmfor the password KDF, with four domain-separated contexts including a dedicated"checkout-pin"context. Every content column in Postgres is opaque bytes; no key that opens any of them ever transits the server. - AI: Anthropic Claude (
claude-sonnet-5) via a thin server-side proxy so the API key never ships in the browser bundle. Retrieval runs locally against the encrypted store; only matched messages leave the device. On-device voice-note transcription via@huggingface/transformerswithwhisper-tiny.en(q4 encoder + fp32 decoder, ~40 MB one-time download). - Payments: Direct REST calls to PayPal Orders API v2 and Paystack Transactions API from the server — no SDK, no client-side secrets. Per-order 5% commission split is a frozen column on the audit row (
fee_cents,net_cents,fee_bps), so a later rate change can't retroactively rewrite history. - Hosted on: Hetzner CX23 + Coolify (git-push-to-deploy) + Neon Postgres.
- Built with Claude Code — the full commerce layer, a QA remediation pass covering 23 audit findings, and most of this project description were written in collaboration with Claude Opus.
Challenges I ran into
- PayPal doesn't settle NGN — or most African currencies. Spent two days chasing the right error-message surface before realising the clean fix was a second payment rail (Paystack) with a currency-driven dispatcher, not a workaround.
- Checkout PIN crypto that doesn't defeat the "lose your password, lose nothing" story. The PIN had to be verifiable without a server round-trip AND not be a second way into the account. Landed on the same Argon2id + secretbox-canary pattern the password unlock already uses, with a dedicated KDF context so neither key can impersonate the other.
- Agent trust model under purchase. Every write tool the agent has uses a "stage first, confirm second" pattern. The order tool extends that with a PIN gate between the confirm card and the actual gateway call — and the agent's prompt had to be hardened against saying "order placed" when nothing had been charged yet.
- External QA pass came back with 23 findings in the final week. Shipped a prioritised fix PR: recovery now evicts pre-reset sessions, message-edit ingest is author-bound, duplicate-id replays can't overwrite history, directory lookups don't leak emails, CSP/HSTS/XFO are set, Unicode tokeniser so Arabic/Chinese/Japanese search works. Documented the accepted trade-offs in the README's new "Security posture" section so they're not hiding in a git log.
Accomplishments I'm proud of
- A working agentic-commerce loop, end-to-end, in one codebase that also carries encryption, voice-note transcription, a public feed, and a per-chat agent — all co-existing without one feature compromising another.
- Two payment rails with one checkout PIN — the buyer's experience is identical whether the money goes through PayPal or Paystack.
- Seller onboarding takes one form — name, description, photo, price. No KYC with a payment processor the seller doesn't know.
- The relay still can't read a single message. Adding payments didn't require weakening any of that.
What I learned
- "Reduce seller friction" beats "expand buyer options." Sellers on Aegent don't need a PayPal merchant account; buyers already have PayPal/Paystack. Where the friction lands decides whether the marketplace fills.
- The merchant-of-record model has real teeth — it's what lets me say "come sell on Aegent" to a Nigerian clothes trader whose only onboarding step is uploading a product photo.
- Agentic commerce is a UX problem, not a payments problem. The hard part isn't calling the Orders API — it's making sure the agent never "says done" before the money moves, that the vendor hears about the sale in the same thread the buyer used to ask about it, and that the buyer feels safe handing a tap over to the agent.
What's next for Aegent
- PayPal Payouts + Paystack Transfers so the Request-payout button actually moves the seller's balance (the ledger is in place; this is one endpoint per rail).
- Subscription-instead-of-commission option for high-volume sellers.
- iOS build — Capacitor is wired, just not packaged yet.
- OpenMLS for forward secrecy — the crypto module is already a single swap point.
- AI-matched Discover ranking — surfacing businesses to the buyers most likely to want them, based on what buyers have been asking their agent about (opt-in, local-only ranking).
Live: https://aegent.cereustechnologies.com
Source: https://github.com/Afeezee/Aegent
Built With
- android
- anthropic-claude
- argon2id
- capacitor
- claude-code
- coolify
- dexie
- express.js
- framer-motion
- hetzner
- hugging-face
- indexeddb
- jwt
- node.js
- paypal
- paystack
- postgresql
- react
- socket.io
- sqlite
- tweetnacl
- typescript
- vite
- whisper
- zod