Add support-agent example: mock customer-support agent

Demonstrates two harness surfaces the previous examples skipped:

- SkillProvider: KB articles in examples/support-agent/kb/ are exposed
  via runtime.SkillProvider. The runtime auto-registers load_skill and
  inlines a compact article index into the static (cacheable) system
  prompt; full bodies load on demand.

- PermissionChecker: tickets_update and escalate_to_human are gated on
  a 'supervisor' flag. FilterToolDefs hides the gated tools from the
  LLM tool list in non-supervisor mode so it doesn't waste turns
  inventing calls that would just be denied.

Five concrete tools (kb_search, tickets_get, tickets_create,
tickets_update, escalate_to_human) plus the auto-registered load_skill.
Five seed KB articles cover refund policy, escalation matrix, account
recovery, password reset, and API rate limits — chosen to exercise the
common support patterns each tool involves.

In-memory ticket store (examples/support-agent/store.go) seeded with
four tickets in different states. Webhook delivery for escalations is
optional via SUPPORT_AGENT_WEBHOOK; when unset the tool prints the
escalation banner to stdout, so the demo runs with only
ANTHROPIC_API_KEY set.

Tests (support_test.go) cover store CRUD, defensive copying, the
permission checker's read/write split, and KB indexing/search — all
offline, no API needed.
This commit is contained in:
sausheong committed 2026-05-08 00:10:49 +08:00
1 parent 152f653dd7
commit 8ed38d7b66
12 files changed
+1368 -2

No files matched your search

@@ -0,0 +1,40 @@
# Refund Policy
Acme issues refunds under the following conditions. The agent should
quote the matching clause verbatim when discussing a refund with a
customer.
## Subscription charges
- **Within 14 days of renewal**: full refund, no questions asked.
- **Day 15–30 of renewal**: prorated refund for unused portion of the
billing period.
- **After day 30**: no refund. Customer may downgrade to take effect at
next renewal.
## Usage / overage charges
- Refunds are **discretionary** and capped at **$100 per billing
period** when one of the following applies:
1. The customer did not receive the 80% / 100% rate-limit warning
emails (verify via `tickets_get` notes or the email-events
dashboard).
2. A documented platform incident on our side caused the spike (cross-
reference status.acme.example).
3. The overage is the customer's first ever and the amount is < $50.
- Overages > $100 require supervisor approval. File a ticket with
priority `high` and escalate.
## One-time purchases (add-ons, professional services)
- Refunds are not available once the engagement begins or the add-on is
consumed.
- Unused engagements may be transferred once to a different team within
the same account.
## Disputes
- If the customer threatens a chargeback or mentions their bank, do
**not** discuss refund eligibility further. File a ticket with
priority `urgent`, status `escalated`, and add an internal note
flagging "billing dispute — chargeback risk". Hand off to billing.