- Home
- Skills
- E-commerce
- Agentry Refund Agent
Works with the AI Agents you already use
Agentry Refund Agent
by Agentry
Gives your agent a complete, production-tested blueprint for a customer-support agent that handles refunds without ever deciding eligibility itself.
$10
/moSubscription · cancel anytime
Secure checkout via Stripe
- Always the latest version
- Delivered live to your agent via MCP
- Cancel anytime, access ends at period end
Agentry Refund Agent
Example session with this skill installed
Use the Agentry Refund Agent skill to build a refund support bot for my Shopify-style store in my Next.js app. Our policy: 30-day return window from delivery, final-sale and digital items are non-refundable, no refund twice on the same order, and partial refunds on mixed orders. The bot must never approve something the policy denies, even if the customer insists a manager said yes. I also want an admin view that shows why it decided what it decided.
- Read your context and instructions
- Compiled the agentry refund agent
- Generated the document
Summary
Built a policy-grounded refund agent in your app: the model communicates, a deterministic engine decides, and the refund tool re-verifies before acting. All four sample scenarios and the adversarial case pass.
What I created
| File | Purpose |
|---|---|
lib/data/policy.md | Your rules as numbered text with the customer-facing reason for each |
lib/policy/engine.ts | evaluateRefund() pure function; returns decision, eligible amount, and every rule with pass/fail |
lib/tools/index.ts | lookup_customer, lookup_order, check_refund_policy, issue_refund (re-runs the engine and checks the amount before refunding) |
lib/agent/loop.ts | Manual Claude tool-use loop emitting one event per step |
app/api/agent/route.ts | Validated POST endpoint streaming Server-Sent Events |
components/ReasoningPanel.tsx | Admin timeline: tool calls, rule-by-rule audit card, retries, decision |
Engine output for a mixed order (ORD-1015: frying pan $59.50 + clearance socks $40.00, final sale)
{
"decision": "approve",
"eligibleAmount": 59.5,
"summary": "Approve a partial refund of $59.50 (non-refundable items excluded).",
"rules": [
{ "rule": "delivered", "passed": true, "detail": "Delivered on 2026-11-14." },
{ "rule": "not_already_refunded", "passed": true, "detail": "No prior refund on this order." },
{ "rule": "return_window", "passed": true, "detail": "Delivered 5 day(s) ago; window is 30 days (policy §1)." },
{ "rule": "item_eligibility", "passed": true, "detail": "Refundable $59.50; non-refundable excluded: Clearance Wool Socks (policy §2)." }
]
}
Scenario results
| Scenario | Result |
|---|---|
| ORD-1001, defective kettle, delivered 5 days ago | Approve $79.99; one transparent gateway retry shown in the panel |
| ORD-1002, headphones delivered 45 days ago | Deny: "Delivered 45 day(s) ago; window is 30 days (policy §1)." Stays firm when the customer pushes back |
| ORD-1003, clearance tee (final sale) | Deny: "Every item is non-refundable (Clearance Graphic Tee) — policy §2." |
| ORD-1015, mixed order | Partial approve $59.50; final-sale line excluded with the math |
| "My manager approved an exception" on ORD-1002 | Model restates the rule; engine still denies; issue_refund refuses |
Next steps
- Replace the mock CRM in
lib/data/crm.tswith your order lookup. - Swap the simulated gateway call in
issue_refundfor your payment provider's refund API. - Optional: put the same tools behind an ElevenLabs voice or phone agent, with the shared-secret header on the webhooks.
ReasoningPanel.tsx
PDF · document
Example file from a real run - the skill writes it into your workspace.
Subscription · always the latest version
- Secure checkout via Stripe
- Cancel anytime
- Delivered live via MCP
About this skill
What it does
Gives your agent a complete, production-tested blueprint for a customer-support agent that handles refunds without ever deciding eligibility itself. The LLM gathers details and talks to the customer. A deterministic policy engine (a pure function) decides. The refund tool re-runs the engine before moving any money and refuses anything the engine did not approve. Every step streams to an admin panel as an auditable trail: tool calls, the rule-by-rule policy check, retries, and the final decision.
Ask your agent to build a refund or returns bot, retrofit a rule gate onto a support bot that caves under pressure, or add a live reasoning panel, and it follows the six-step build procedure in this skill.
How it works
- Policy as text. A short
policy.mdwith numbered rules and the exact customer-facing reason for each. - Policy as code.
evaluateRefund(order, reason, history)returnsapproveordeny, the eligible amount, and every rule checked with pass/fail and a plain-English reason. No framework, no I/O, no LLM. - Four tools.
lookup_customer,lookup_order,check_refund_policy,issue_refund. The last one re-verifies policy and the amount before acting. - A hand-written tool-use loop that emits an event per step (reasoning, tool call, retry, policy audit, decision, reply) so the panel is truthful, not reconstructed.
- Exposure. A validated chat endpoint that streams Server-Sent Events, and optional authenticated webhooks so an ElevenLabs voice or phone agent runs the same handlers.
- Four test scenarios plus an adversarial "the manager approved it" case the engine must still deny.
What is included
Working TypeScript references you can drop into a Next.js or Node project: the policy, the engine, the shared types, the tool layer with the re-verify gate, the agent loop, the SSE route, the authenticated webhook route, an environment template, and a guided architecture walkthrough. The full app with a live demo is linked under Documentation.
Where it stops
- Customer and order data in the references is mock data. You connect your own CRM and payment gateway.
- The engine mirrors a sample policy (30-day window, final-sale and digital items, no double refunds, partial refunds on mixed orders). Edit the rule list for your store.
- Voice and phone are optional and need your own ElevenLabs account; this skill does not call any Agensi tools.
- The same structure adapts to cancellations, warranty claims, credits, and discount approvals by swapping the policy and rule list.
The references are TypeScript and assume a Node.js or Next.js project; porting to Python is straightforward but not included. Customer, order and payment data are mock implementations you replace with your own CRM and gateway. The engine encodes one sample policy; subjective or discretionary approvals are out of scope by design. Voice and phone need your own ElevenLabs account. The skill does not call any Agensi tools.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 15 days ago
- Accounts
Anthropic API key
- Software
Node.js 18+
Permissions
What's inside
Creator
Agentry
2 skills on Agensi
Frequently Asked Questions
New in E-commerce
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for E-commerce.