eCommerce · Case Study

An AI Returns Assistant That Knows When to Escalate

The customer says the item arrived damaged. The policy allows ordinary returns, but damage claims need a different review. A fluent reply that applies the wrong policy would create more work than it saves.

Explore eCommerce automation →

How can AI assist returns without approving refunds?

An assistant can classify a return request, retrieve the permitted order details and draft a response grounded in the applicable policy version. A rules service should decide ordinary eligibility from dates and product conditions. Missing evidence, ambiguous intent and policy exceptions go to support staff. Refund authorization remains outside the model. The system records the evidence, draft and reviewer decision so the team can inspect why a response was suggested.

Interactive demo

Read the conversation with the policy beside it

Open the customer message, compare it with the applicable policy and inspect the suggested reply. The damage-claim path stops for missing evidence.

Local interactive demo

Returns review session

Fictional records
I would like to return an unopened item.
Agent review / not a customer send

No draft prepared

Select a ticket and prepare its policy-grounded internal note.

Refund execution is outside the assistant’s permissions.

Agent approval remains separate from deterministic eligibility checks.
Reference records for this demo
Support ticket queue
TicketRequestPolicy evidenceRouting
RET-214Unopened itemWithin return windowDraft ready
RET-215Damaged itemPhotograph not suppliedEscalate
Interactive reconstruction using fictional records. All actions stay in this browser session. No client system, message, purchase, approval or invoice is changed.

Related implementation: explore another BytePilot workflow.

policy clinic

A useful draft starts with a policy decision

A standard return, a damage claim and a request for a policy exception can sound similar in a customer message. They need different evidence and may need different people. The assistant’s job is to prepare that distinction for review.

Before the draft

Retrieve only the right customer context

A ticket event triggers a Lambda handler. FastAPI verifies ticket ownership and customer identity before querying the commerce order source. The order API and durable audit storage are separate integration dependencies.

Outside the model

Keep policy decisions outside the draft

Version the policy and evaluate return windows, final-sale flags and required evidence in code. Claude receives approved excerpts and minimal order fields, then returns a structured classification, evidence references and draft. Treat ticket text as untrusted content, never as tool instructions.

A recommendation needs the right reviewer

Calibrate classification thresholds against labeled historical tickets rather than trusting a model confidence statement. Missing citations, conflicting policies, sensitive complaints and low-confidence classifications all block automatic handling. Initially save every suggestion as an internal note for agent approval.

Eligibility
Versioned policy rules
Response
AI draft, agent approval
Refund
Separate authorized decision

Language fluency is not an eligibility check. The policy version and order facts must be established before the assistant prepares a reply.

Review the reply before celebrating the response time

A faster draft is useful only when it is grounded in the right order and policy. Review quality and escalation routing beside preparation time. These are evaluation criteria, with no measured improvement claimed.

Time to a usable reply

First response preparation time

Time from ticket assignment to approved draft, compared with a matched manual sample.

Policy and factual quality

Draft correction rate

Reviewed drafts requiring factual or policy changes divided by reviewed drafts.

Correct review route

Escalation precision

Specialist-confirmed escalations divided by all escalations in a labeled review sample.

Customer privacy

Unauthorized data exposure

Count failed access-control tests and confirmed cross-customer retrieval incidents; review both before expanding scope.

Technical details

The model drafts inside a permission boundary

Ticket retrieval, eligibility rules and response drafting have different responsibilities. Refund authority stays outside the model’s tool access.

AWS LambdaTicket event

Handle ticket events and scheduled recovery checks.

verified event
Zendesk APIAssigned ticket

Read assigned tickets and save internal draft notes.

Authorized context and deterministic rules
FastAPICustomer and policy gate

Enforce eligibility rules and tool permissions.

RedisScoped, short-lived cache

Cache short-lived context and coordinate rate limits; not the audit store.

ClaudeClassify intent · draft with citations

Classify intent and draft grounded replies.

Only approved excerpts and minimal order fields enter the model context.
Refund tools: no accessSupport approves replies. Refund authorization follows a separate process.
Simplified implementation architecture. Open a technology to inspect its responsibility.

Customer isolation and review evidence

Apply least-privilege ticket scopes and customer-level authorization in the API. Store policy version, retrieved record IDs, model version, draft, reviewer and decision in durable encrypted audit storage. Cache keys include tenant and customer scope with short expiry. Alert on failed lookups and draft backlog; never put secrets or full payment data in prompts.

Challenge the assistant with the wrong policy and customer

Evaluate false eligibility decisions on an anonymized labeled set. Include policy changes, malicious ticket instructions, wrong-customer references and unavailable order APIs. Deduplicate ticket events by ticket revision; retry transient reads with limits and send persistent failures to support. Roll out internal notes before considering any permitted automated replies.

What the assistant may say and who decides

Can the assistant issue refunds?

The model has no refund tool. An authorized person follows a separate finance or support approval process.

How does it know which return policy applies?

The policy service supplies the approved version applicable to the purchase and product. Conflicting versions stop the workflow for review.

What does low confidence mean?

Routing uses thresholds evaluated on labeled examples plus evidence-completeness checks. A model saying it is confident is not sufficient.

Can customers manipulate the assistant through a ticket?

Ticket content is untrusted. Server-side permissions and allowlisted read tools restrict what the model can access even if malicious instructions appear in the text.

Related case studies

DISPATCH / ORD-1042Webhook received
▣SHOPIFY ORDERORD-1042Paid · address verified
✓dispatch key
⌂WAREHOUSE NORTHWH-204Receipt linked to order
01Original eventAccepted
02Repeated eventReuse receipt
03Missing postal codeHold
Event receipt → validation → dispatch ledger → warehouse acknowledgement.
Sample data · Interactive demo inside
eCommerce

From Order Chaos to Automated Fulfillment

Paid orders pass through spreadsheets before warehouses and delivery partners receive them.

  • Shopify API
  • n8n
  • PostgreSQL
  • Python
  • Webhooks
View case study
CHANNEL INTELLIGENCESample period · MYR
NET REVENUE · DEMORM 114,000
Five source feeds
42kDirect
28kMarket A
19kMarket B
14kSocial
11kWholesale
DirectRM 42,000Inspect order facts, refund period and source freshness.
Sample data · Interactive demo inside
eCommerce

One Revenue Dashboard Across Five Sales Channels

Sales, advertising, refunds and fulfillment costs use incompatible channel definitions.

  • BigQuery
  • Airbyte
  • dbt
  • Looker Studio
  • SQL
View case study

Customer support across channels

See how to manage customer chats across eCommerce channels, with AI replies, specialist handoffs and separate cases for different issues.

Discuss your returns workflow

Choose the return decision your team repeats most

Start with a policy your support lead can explain and a small set of anonymized tickets. We can map what the assistant may retrieve, what it may draft and which decisions remain with your team.

Discuss your returns workflow →

AI-assisted operations · Choosing a workflow to automate

The rule

The approved return policy and its exceptions

The difficult reply

Examples of replies that needed correction