Skip to content

Case 03 / Ordering agent · bilingual

Wingman

Order KFC Vietnam entirely inside a chat, in Vietnamese or English — while deterministic server code, not the model, owns every price.

Menu74 real items, both languages
Pricingevery line re-priced server-side
Tests65 across 10 files
StackAI SDK v7 · Supabase · Zod · Vitest
wingman — chat commerce200 OK
Wingman — ordering chat

Demo

youtube.com/watch

The rule

The agent builds the cart, but checkout re-prices every line from the catalog server-side and re-validates the voucher — a compromised client can't change a single price.

Build notes

Computed upsell, not prompted

A pure module (14 tests) works out the exact gap to a voucher and the cheapest add-on that closes it; the LLM only phrases the sentence. Added after a prompt-only nudge silently failed.

Idempotent checkout

Racing double-submits collapse into one order via a partial unique index on the idempotency key — no double charge, no double loyalty redemption.

The code-switching fix

Mid-sentence Vietnamese/English switching was fixed with two fully monolingual system prompts behind a pinned language toggle — a documented bug-and-fix, not a guess.

Spend guard

Every model call is priced in micro-USD and cut off at $20/day, reset on Vietnam time.

More screens

Wingman's checkout drawer showing the delivery address form, order summary, and total
A Vietnamese chat turn in Wingman with the agent's reply, running cart total, and ops sidebar