Refund Agent is an AI customer-support demo for e-commerce refunds.
Customers chat with the agent, but there is exactly one payout path: a typed tool that re-runs a deterministic policy engine before any refund is issued. The model can propose; code decides.
System
- Synthetic CRM with customers, orders, edge cases, and a written refund policy
- Agent loop with typed tools for lookup, order retrieval, policy checks, refund issuance, and escalation
- Deterministic policy engine for final-sale, digital goods, delivery windows, duplicate refunds, and value thresholds
- Admin dashboard for inspecting every reasoning trace and tool call
Runtime
- Next.js API route streams the tool-using agent run to the chat UI
- In-memory store keeps the demo zero-config while leaving a clear database seam
- Optional Stripe refund path uses idempotency keys when real payment credentials exist
- Admin routes can be gated by token while localhost development remains lightweight
Proof
issue_refundrechecks policy before touching payout state, so prompt injection cannot force an invalid refund- Tool-layer ownership checks prevent customers from refunding another customer's order
- Trace records include tool inputs, outputs, blocked calls, token cost, latency, retries, and final decision
- Vitest coverage exercises the policy engine and scenario matrix