# Setup guide — Refund & Returns Resolution Agent

## 1. Install and connect commerce

Install the agent and connect your order and refund systems.

```
pipx install refund-resolver-agent
refund-resolver-agent connect --platform shopify --payments stripe
refund-resolver-agent doctor
```

## 2. Configure policy & cap

Ownership verification and the refund cap are enforced here.

```
cp .env.example .env
ANTHROPIC_API_KEY=sk-ant-...
VERIFY_OWNERSHIP=true
REFUND_AUTO_CAP_USD=100
RETURN_WINDOW_DAYS=30
```

## 3. Load the refund policy

Provide the rules the agent must apply.

```
# policy.yml
returns: { window_days: 30, condition: unused, proof: receipt_or_order }
refunds: { auto_cap_usd: 100, method: original, over_cap: escalate }
alternatives: { out_of_window: store_credit_if_eligible }
```

## 4. Dry-run on past tickets

Replay refund tickets to check decisions before going live.

```
refund-resolver-agent backtest --range 30d --explain
# reports decisions + a hard check: over-cap/out-of-policy approvals (must be 0)
```

## 5. Wire into support

Route refund/return requests through the agent; exceptions escalate.

```
# refund request -> verify -> approve within cap / deny / escalate; all logged
```
