RefundsAI
Natural conversation. Controlled transactions.
A conversational refund workflow that keeps policy, consent, and transaction execution under backend control.
- Platform
- Web App
- Scope
- Full-stack
- Team
- Independent
- Status
- Complete
- Started
- Jul 2, 2026
Project context
Customer support conversations may appear simple, but refund decisions sit at the intersection of policy, customer intent, transaction state, and irreversible actions.
Introducing AI into that workflow creates a difficult boundary: the system needs enough flexibility to understand natural language without allowing a probabilistic model to become the authority over financial decisions.
The challenge
- Flexible requests need precise refund rules
- Consent cannot depend on model interpretation
The approach
- AI explains purchases and available options
- Backend services verify and execute changes
From intent to interaction
Describe the request
Ask about a purchase or refund in natural language.
Review the options
Retrieve purchase facts and evaluate the applicable policy.
Confirm the action
Persist explicit confirmation before the guarded workflow changes transaction state.
What it makes possible
Ask in natural language
Find purchases and explore refund options in natural language.
Confirm before acting
Require explicit consent before changing transaction state.
Inspect the session
Review policy checks and actions in an ordered audit trail.
How the pieces fit
Customer and admin views
Support conversations and review session history.
Next.js and TypeScriptWorkflow and policy
Keep policy and transactions under backend control.
FastAPI and LangGraphTransaction record
Store purchases, consent, and ordered audit events.
PostgreSQLConsent is a persisted fact
Require persisted, once-consumable confirmation before changing a transaction.
Make the sequence reviewable
Record model, tool, and transaction events in a reviewable sequence.
Engineering notebook
Explore the design, data flow, and implementation in more detail.
Customer and admin views
Support conversations and review session history.
Next.js and TypeScriptWorkflow and policy
Keep policy and transactions under backend control.
FastAPI and LangGraphTransaction record
Store purchases, consent, and ordered audit events.
PostgreSQLRefundsAI was built to explore how AI agents can participate in transactional workflows without becoming the source of truth.
The system allows customers to ask questions naturally, understand refund eligibility, review purchase information, and move through a refund workflow conversationally. Behind that experience, deterministic services retain control over policy, consent, refund amounts, and transaction state.
The goal is not simply to automate refunds, but to establish a clear boundary between what AI can interpret and explain and what the application must verify before taking action.
Implementation
RefundsAI separates conversational orchestration from transaction authority. A Next.js frontend provides customer and administrative interfaces, while FastAPI coordinates request handling, LangGraph workflows, backend services, and PostgreSQL persistence.
The language model is limited to natural-language interpretation, grounded read operations, and explanation. Eligibility, consent validation, refund amounts, and lifecycle transitions are computed and enforced by deterministic backend services.
Mutation workflows require persisted confirmation facts before execution, allowing the system to use an AI agent without granting the model direct authority over transactional state.
Describe the request
Describe a purchase question or refund request.
Review the options
Retrieve purchase facts and evaluate refund policy.
Confirm the action
Save explicit consent before changing a transaction.
Customers open the support panel and describe what they need in natural language, whether they are asking about a purchase, checking refund eligibility, or attempting to begin a refund.
RefundsAI gathers the relevant purchase and policy information, explains the available options, and guides the customer through any required confirmation before an action can occur.
After a transaction progresses, the customer interface reflects the resulting purchase state while administrators can review the complete sequence of decisions, tool calls, validations, and actions through a dedicated audit surface.
Implementation
Each chat request enters a LangGraph workflow where customer identity, page context, active workflow state, and conversation context are resolved before tools are selected.
Read-only backend tools retrieve customer records, purchase history, policy rules, and eligibility facts. The model receives only the information required to interpret or explain those results rather than owning the underlying business logic.
When a refund requires action, the backend generates a product-specific confirmation command. Exact confirmation is persisted and validated before guarded mutation services execute the appropriate lifecycle transition. The resulting database state is then verified and surfaced back to both the customer interface and administrative audit timeline.
Consume confirmation once
Check persisted consent and consume it only once.
Respect lifecycle boundaries
Wait for external conditions before physical refunds.
Keep an ordered audit
Keep audit events in their original execution order.
RefundsAI is designed around a simple principle: conversational intelligence and transactional authority should not be the same thing.
The AI can understand flexible customer language, determine which information is relevant, and explain what the system knows. It cannot independently decide that a refund is valid, invent an amount, infer consent, or authorize a transaction.
By narrowing the responsibilities of the model, the system preserves the usability of an AI support experience while keeping consequential decisions explicit, reviewable, and enforceable.
Implementation
The platform combines a Next.js and TypeScript frontend, FastAPI backend, LangGraph orchestration layer, OpenAI model integration, and Supabase PostgreSQL persistence.
Application services establish explicit authority boundaries between model-driven reasoning and deterministic business operations. PostgreSQL stores purchase state, confirmation facts, audit sessions, and ordered audit events, while database triggers derive selected deadlines and lifecycle defaults from persisted records.
Refund mutations are protected through exact, once-consumable confirmation gates. Digital and subscription workflows can progress through guarded preparation and issuance, while physical returns stop at return preparation until the required external lifecycle condition is satisfied. Canonical confirmation turns can bypass the language model entirely and complete through deterministic backend execution.
Bounded Agent Orchestration
Use LangGraph to coordinate interpretation, read tools, and grounded explanations.
Deterministic Policy Authority
Compute eligibility, deadlines, and amounts from stored facts in backend services.
Confirmation-Gated Mutations
Require exact, saved confirmation that can be consumed only once before a mutation.
Context-Aware Purchase Resolution
Resolve purchase references from page context, identifiers, and active workflow state.
End-to-End Audit Trail
Record ordered model, tool, consent, and transaction events for session review.
Ask about purchases naturally
Use conversational language to locate purchases, review transaction history, and ask questions without navigating rigid support menus.
Check refund eligibility
Understand whether a purchase qualifies for a refund using product-specific rules evaluated against actual transaction data.
Complete guided refund workflows
Move from eligibility review to explicit confirmation and refund processing through a conversational workflow with clearly defined action boundaries.
Keep consequential actions controlled
Require explicit customer authorization before refund-related state changes can occur rather than allowing conversational ambiguity to trigger transactions.
Review how decisions were made
Inspect complete support sessions through an administrative audit interface showing model activity, tool usage, validation steps, transaction events, and process metrics.
Implementation
Bounded Agent Orchestration
Uses LangGraph to coordinate conversational reasoning while restricting the model to interpretation, read-oriented tool selection, and grounded explanation.
Deterministic Policy Authority
Evaluates refund eligibility, deadlines, amounts, and lifecycle rules through backend services operating on persisted purchase facts rather than model inference.
Confirmation-Gated Mutations
Requires exact, persisted, once-consumable confirmation commands before transactional services can modify refund or purchase state.
Context-Aware Purchase Resolution
Combines page context, active workflows, explicit identifiers, result sets, and compact conversation state to resolve references such as products, purchases, and ordinal selections.
End-to-End Audit Trail
Persists ordered model, tool, validation, consent, and mutation events and streams them into an administrative interface for session-level inspection and traceability.
Have a related challenge?
Let’s talk about it.
Bring an idea, a workflow to improve, or a technical question. We can work through what comes next.