# Agentry Refund Agent

> Production-tested pattern for a refund support agent: the LLM talks, a deterministic policy engine decides, the refund tool re-verifies before moving money, and every step streams to an audit panel. Ships the engine, tool layer, agent loop and policy as drop-in TypeScript references.

Agentry Refund Agent is a subscription AI agent skill on Agensi by Agentry, in E-commerce. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $10/mo (subscription, cancel anytime)
- Creator: [Agentry](https://www.agensi.io/creators/agentry)
- Category: [E-commerce](https://www.agensi.io/skills/ecommerce)
- Version: 1.1
- Last updated: 2026-11-19
- Security: scan passed (2026-11-19); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/agentry-refund-agent
- Tags: ecommerce, ai-agents, api, customer-support, refunds, e-commerce, agents, tool-use

## 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

1. **Policy as text.** A short `policy.md` with numbered rules and the exact customer-facing reason for each.
2. **Policy as code.** `evaluateRefund(order, reason, history)` returns `approve` or `deny`, the eligible amount, and every rule checked with pass/fail and a plain-English reason. No framework, no I/O, no LLM.
3. **Four tools.** `lookup_customer`, `lookup_order`, `check_refund_policy`, `issue_refund`. The last one re-verifies policy and the amount before acting.
4. **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.
5. **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.
6. **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.

## Requires

- Node.js 18+
- Anthropic API key

## Known limitations

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 this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Agentry Refund Agent skill from Agensi" and describe your task.
3. Subscribe on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill prevent the 'hallucinated refunds' common in standard LLM chatbots?

Standard LLM prompts can be manipulated by customers to grant unauthorized exceptions; this skill uses a deterministic TypeScript engine that acts as a physical gate, ensuring money only moves when strict code-defined rules are met.

### What exactly is included in the purchase of this skill?

The skill includes a production-ready TypeScript/Node.js architecture, the core policy engine, reference implementations for SSE and voice webhooks, and structured templates for defining your refund rules.

### Is this architecture compatible with models other than Claude?

While optimized for Claude via the Anthropic SDK, the architecture is framework-agnostic and can be adapted to any LLM that supports tool-use and manual execution loops.

### How much effort is required to integrate this into my existing e-commerce stack?

Setup involves defining your specific refund rules in the provided policy format and mapping your order database to the included tool interfaces; it is designed to be integrated into existing Node.js or Next.js environments.

### How can I monitor why the agent approved or denied a specific refund request?

The skill provides a custom tool-use loop that emits granular events for every policy check and API call, allowing you to build real-time monitoring dashboards or searchable audit logs for compliance.

### Can this agent handle subjective refund requests that fall outside of hard-coded rules?

The engine is designed for objective, rule-bound logic (e.g., date windows, item categories); it is not intended for subjective 'vibe-based' approvals where a human's emotional judgment is required.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
