Policy-Grounded Support Agent
Customer Refund AI Agent
A working AI support agent that chats with customers about refund cases, applies policy logic, and escalates when needed — with every decision logged.
- LangGraph
- FastAPI
- Next.js
- Policy Engine
- Claude API
- Pytest
01
Problem
Refunds are where support automation usually breaks: a pure LLM agent will eventually approve a refund it shouldn't, or cite a policy that doesn't exist. The business needs conversational speed without giving up control of decisions that cost money. This system — built under the internal codename RefundPilot — solves that split.
02
Agent flow
The conversation runs through a LangGraph state machine: understand the request, collect order details, evaluate against policy, then respond or escalate. The graph keeps the agent on rails — it cannot skip the policy check or invent an outcome.
- Intent and order-detail extraction from the conversation
- Policy evaluation as an explicit graph node
- Respond, deny with explanation, or escalate — never improvise
03
Policy decision logic
Eligibility is computed by a deterministic rules engine — return window, item category, refund caps, prior history. The LLM explains the decision in plain language; it never makes the decision. The same conversation always produces the same outcome.
04
Human escalation
Anything outside clear policy — disputed claims, high-value orders, ambiguous evidence — routes to a human queue with the full conversation and the agent's partial assessment attached, so the reviewer starts with context.
05
Admin dashboard and reasoning logs
A Next.js dashboard lists every conversation with its outcome, the policy rules that fired, and the agent's reasoning trail. Support leads can audit any decision after the fact — the system is designed to be questioned.
What makes it credible
- Deterministic policy engine — the LLM never decides money
- Reasoning logs on every refund decision
- Human escalation path for edge cases
- 21 automated tests across agent flow and policy rules
Best fit for
- E-commerce & customer support teams
- Refund and returns operations
- Teams needing policy-grounded agents with escalation
Operating principles applied
- Human approval where decisions matter
- Policy engine before LLM decision
- Escalation for edge cases
- Reasoning logs for auditability
Roadmap
- Policy editor UI so owners can change rules without code
- Live order, payment, and support-ticket integration
- Expanded admin review queue and escalation workflow
- Broader policy scenarios with replay-based evaluation
- Multi-language conversations
Want a system like this for your workflow? Discuss a workflow or see other systems.