Files
sausheong 8ed38d7b66 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.
2026-05-08 00:10:49 +08:00

1.9 KiB

API Rate Limits

Default limits for Acme API clients. When a customer reports 429s or unexpected throttling, check their plan tier first via the dashboard before escalating.

Default limits per plan

Plan Requests / minute Requests / day Concurrent streams
Free 20 1,000 1
Starter 120 50,000 5
Growth 600 500,000 25
Enterprise Custom (≥ 1,200) Custom Custom

How to read the headers

Every response includes:

  • X-RateLimit-Limit — the per-minute cap
  • X-RateLimit-Remaining — calls left in the current window
  • X-RateLimit-Reset — Unix epoch (seconds) when the window rolls over
  • Retry-After — present on 429 responses; seconds to wait

Tell customers to back off using Retry-After, not arbitrary delays.

When 429s aren't actually rate limits

A surprising fraction of "rate limit" tickets are something else. Rule these out before escalating:

  1. Auth failure cascading: 401s in a tight retry loop look like 429s when the customer reads aggregate request graphs. Confirm by checking response codes individually.
  2. Same key on multiple processes: the limit is per-key, not per-process. A customer running 4 workers on a Starter plan will share 120 RPM across all of them.
  3. Quota vs rate: hitting the daily quota returns 429 too. Check X-RateLimit-Limit — if it's the daily number, they need a higher plan, not a rate-limit increase.

Requesting an increase

  • Free / Starter / Growth: increases are not granted; suggest upgrading.
  • Enterprise: file a ticket with priority high, subject Rate-limit increase request, and CC the account's CSM.