Returns and Refunds in Agentic Commerce: Agent State Management and Exception Handling
Returns and refunds represent one of the highest-friction points in commerce—and one of the poorest-understood challenges in agentic systems. A post-purchase agent must balance customer satisfaction, fraud prevention, inventory reconciliation, and payment settlement across multiple stateful processes. Yet most agentic commerce architectures treat returns as an afterthought, forcing human intervention when agents encounter edge cases.
This article builds on the existing UCP coverage of inventory sync and payment settlement to address a critical gap: how do agentic commerce agents maintain internal state during the returns lifecycle, and what happens when an agent makes a refund decision that conflicts with upstream systems?
The Returns Problem in Agentic Systems
Traditional e-commerce returns are linear: customer initiates, warehouse inspects, system credits account. Agentic commerce inverts this: agents must decide autonomously whether to approve a return, calculate refund amounts, coordinate inventory reinstatement, and trigger payment reversal—all while maintaining state consistency.
The challenge emerges in three dimensions:
1. State Divergence Across Systems
An agent approves a $500 refund and marks inventory as "return pending." Simultaneously, the fulfillment agent receives conflicting state from warehouse management (physical return not yet received) and the payment agent sees the credit pending in the processor queue. Which system of record wins? How does the agent know when state is "stale"?
2. Partial Refund Logic
A customer returns one item from a three-item order with free shipping. Should the agent refund shipping proportionally? Apply restocking fees? Reverse loyalty points? These decisions require agent reasoning over structured rules, yet most systems hardcode policies that don’t adapt to regional compliance (EU mandatory refunds vs. US discretionary).
3. Exception Routing and Human Escalation
An agent detects a fraudulent return pattern (same customer, 10 returns in 30 days, 80% restocking fee). Does it auto-reject and flag the account? Does it approve with reduced refund pending fraud review? The agent’s decision tree must support probabilistic confidence thresholds and graceful handoff to human reviewers.
Agent State Architecture for Returns
Effective agentic returns require a distributed state machine where the agent maintains its own working memory while synchronizing with authoritative sources.
Return Request State:
The agent tracks: initiation timestamp, customer identity, order reference, item SKUs, reason code (defective/wrong item/changed mind), customer-provided evidence (images, descriptions), and refund amount proposed. This state lives in the agent’s ephemeral context, not the database—enabling the agent to reason over incomplete information and gradually build confidence.
Inventory Return State:
The agent queries the fulfillment agent: "Is this SKU returnable under current policy? What’s the restocking fee for this category? Has the item already been received at the warehouse?" The fulfillment agent responds with authoritative inventory state, and the commerce agent cross-references this against the return request. If physical inventory contradicts the system state, the agent escalates rather than deciding unilaterally.
Payment Settlement State:
Once the return is approved, the agent must coordinate with the payment agent to initiate a refund through the original processor (Stripe, PayPal, Visa). The agent records: refund request ID, idempotency key (to prevent duplicate credits), original payment method, and settlement status. It polls for confirmation that the processor has accepted the refund request, marking the refund as "pending settlement" until the processor confirms funds have left the merchant account.
Loyalty and Tax State:
If the original order included loyalty points redemption or tax calculation, the agent must coordinate reversal. This is often overlooked: a $100 refund on an order where the customer earned 1,000 bonus points requires the agent to either reverse the points or issue a cash equivalent, depending on program rules and tax jurisdiction.
Stateful Return Workflows: Example Scenario
Customer Sarah purchased a $200 winter jacket on March 10, 2026, from a US-based retailer. The order included $10 shipping and was subject to 6% sales tax. She initiates a return on March 20 (within 30-day window) claiming "wrong size."
Agent Decision Loop:
1. Policy Check: The agent queries the merchant’s returns policy. Result: 30-day full refund, free return shipping, no restocking fee for apparel. Sarah is within the window.
2. Fraud Assessment: Agent checks Sarah’s history. 2 prior returns in 12 months, both within 30 days, both approved. No flag. Risk score: low.
3. Inventory State: Agent queries fulfillment system. Warehouse has not received the physical item yet. Agent sets return status to "awaiting physical receipt" and provides Sarah with a prepaid shipping label.
4. Conditional Refund Approval: Agent sends Sarah a message: "Return approved. When we receive your jacket at the warehouse (typically 3–5 business days), we’ll process a full refund of $210 (including tax and shipping). You can track your return here [link]."
5. Warehouse Integration: When the jacket arrives, the fulfillment agent receives a barcode scan and updates the return state to "physically received." This triggers the commerce agent to advance to refund settlement.
6. Quality Check: The fulfillment agent (or human) inspects the jacket. If unworn and resellable, the agent marks it for restocking. If damaged, the agent flags it for review, and the commerce agent may reduce the refund.
7. Refund Settlement: Once quality check passes, the commerce agent initiates a refund of $210 to Sarah’s original payment method (Visa). It records the idempotency key and polls the payment processor for confirmation.
8. Reversal of Loyalty: If Sarah earned bonus points during the original purchase, the agent reverses those (or offers cash equivalent depending on loyalty program terms).
9. Tax Reversal: The agent records the refund for tax reconciliation (important for US merchants filing sales tax returns or EU VAT adjustments).
Exception Handling and Escalation
Not all returns follow the happy path. Agent state machines must define escalation thresholds:
Customer Claims Defect, But Physical Item Shows No Damage:
The agent has conflicting evidence. It approves the refund but flags the return for merchant review. Agent state records: "customer_claim: defective, warehouse_inspection: no_visible_damage, agent_confidence: medium, recommended_action: merchant_review." A human reviews the claim and evidence images before the refund settles.
Customer Initiates Return Without a Traceable Order:
The agent cannot find an order matching the provided email + date range. Instead of rejecting outright, it escalates with context: "Order not found in system. Customer reports purchase on [date]. Please verify." A human checks legacy records or PayPal/guest checkout history.
Return Initiated After Policy Window Expired:
The agent checks the order date: 35 days ago. Policy allows 30 days. The agent does not auto-reject; instead, it assigns a confidence score and recommends to the merchant: "Return requested outside policy window. Recommend approval to retain customer (LTV: $1,200) or rejection per policy. Decision?"
Fraud Pattern Detected:
An agent observing the same customer initiating 5 returns in 2 weeks across different SKUs calculates fraud probability. If confidence exceeds threshold (e.g., 75%), the agent freezes the return and escalates: "Potential return fraud detected. Recommend hold and account review before approval."
Payment Agent Coordination: Refund Timing
A critical failure mode: the commerce agent approves a refund, but the payment agent cannot process it because the original payment is still in dispute, or the processor has a 90-day window for reversals.
Proper coordination requires the commerce agent to query the payment agent before committing to a refund timeline. The payment agent responds with: "Original transaction (Visa, last4 1234) processed March 10. Refund window: open until June 10. No disputes filed. Ready to accept refund request."
If the refund window has closed, the agent must offer an alternative: store credit, payment to a new card, or manual ACH transfer (if permitted by compliance rules).
Regional Compliance in Returns State
EU law (Consumer Rights Directive) grants 14-day cooling-off periods with mandatory refunds. US law is state-specific and merchant-controlled. An agentic commerce system serving both regions must embed compliance rules into the agent’s state machine.
EU Customer: Agent enforces 14-day window. If within window, refund must be approved (unless goods are non-returnable by law, e.g., underwear). No restocking fees permitted.
US Customer: Agent applies merchant’s policy, which may vary by state and product category. Agent can approve restocking fees, enforce shorter windows, and deny returns for opened items (if policy permits).
The agent’s state must track customer location and tax jurisdiction to apply the correct rules.
Integration with UCP Protocol
The Universal Commerce Protocol defines standardized messages for order, payment, and fulfillment agents. Returns require an extension: a ReturnRequest message type that includes:
- Order reference
- Item SKU and quantity
- Return reason code
- Customer evidence (images, text)
- Requested refund amount
- Merchant approval decision
- Refund settlement instruction (original payment method, alternative, etc.)
When a commerce agent receives a return request, it publishes a ReturnDecisionMade event that triggers fulfillment and payment agents to update their own state. This ensures eventual consistency across distributed agents.
FAQ: Returns and Refunds in Agentic Commerce
Q: If an agent approves a refund but the payment processor denies it, what happens?
A: The agent records the processor rejection in the return state and escalates to the merchant with context. The agent may suggest alternative settlement methods (store credit, ACH transfer) or manual processing. The refund state transitions from "approved" to "settlement_failed" rather than "settled."
Q: How does an agent handle partial refunds (e.g., customer returns 1 of 3 items)?
A: The agent calculates refund amount based on per-item pricing, prorates shipping if applicable, and adjusts for restocking fees or loyalty reversals. It must query the merchant’s refund policy to determine whether refunds are itemized or lump-sum. For complex cases, it escalates with a recommended calculation.
Q: What if an agent detects return fraud?
A: The agent does not auto-reject or approve. Instead, it freezes the return, calculates fraud probability, and escalates to the merchant with evidence: prior return history, pattern analysis, and confidence score. The merchant or a human reviewer makes the final call.
Q: Can an agent reverse a return after it’s been settled?
A: Only if the merchant’s policy permits post-settlement adjustments. The agent must first check with the payment agent whether a reversal-of-reversal is possible (usually not allowed by processors). If not, the agent may issue a debit to the customer’s account or process a new charge (with consent).
Q: How do agents handle international returns?
A: The agent queries fulfillment for return shipping address (may differ by country for cost optimization). It applies regional compliance rules (EU 14-day mandatory window, etc.). It coordinates with the payment agent to refund in the original currency, accounting for FX fluctuations if necessary. For high-risk jurisdictions, it escalates to a human reviewer.
Q: What happens to refund state if the agent crashes mid-return?
A: The agent’s ephemeral state is lost, but the return record persists in the database and in the payment agent’s queue. On recovery, the agent queries the database and payment agent to reconstruct state, then resumes from the last known checkpoint (e.g., "refund request submitted, awaiting processor confirmation").
Conclusion
Returns and refunds in agentic commerce are far more than a checkout feature—they are a test of distributed state management, compliance reasoning, and graceful escalation. Merchants implementing agentic systems must build return agents that maintain transparent state, coordinate across fulfillment and payment systems, embed regional compliance, and escalate with high-confidence context rather than defaulting to human intervention.
The next generation of commerce agents will compete not on how many transactions they can process autonomously, but on how intelligently they handle the 5–10% of orders that require careful judgment and cross-system coordination. Returns are that arena.

Leave a Reply