Skip to content

feat(agent-api): paid Agent Access add-on (§11b) + cost-safe Claude scoring#104

Open
maryadawson-code wants to merge 2 commits into
mainfrom
feat/agent-access-paid
Open

feat(agent-api): paid Agent Access add-on (§11b) + cost-safe Claude scoring#104
maryadawson-code wants to merge 2 commits into
mainfrom
feat/agent-access-paid

Conversation

@maryadawson-code

Copy link
Copy Markdown
Owner

Agent Access — paid add-on (§11b) + cost-safe AI scoring on Claude

Follow-on to the merged read API (#103). Two things you asked for: make Agent Access a paid upgrade, and deliver the AI scoring on your current ecosystem (Claude) without token overrun.

Paid add-on — per the §11b pricing you shared (+ your "allow monthly too")

  • Per-seat: $39/mo first agent, +$29/mo each additional. A seat = one active connection (token).
  • Any active premium tier can buy it (you opened it to monthly users — so no annual-only gating).
  • Institutional = unlimited, included (no purchase).
  • Lapsed add-on → API access stops (read middleware re-checks; fails open on a DB blip so paying users aren't locked out).
  • Upsell UI: members without the add-on see "$39/mo per agent" + Stripe checkout links; members with it see the wizard + "Using N of M seats."

Cost-safe scoring (Claude / your Anthropic key — no Gemini/OpenAI/AWS)

Every token lever is bounded: score each opp once (no user×opp blowup), max_tokens 256, input truncated, 7-day TTL skip, per-run call cap, daily USD ceiling that halts the run. Per-user fit is a free heuristic. Flag-gated (AGENT_SCORING_ENABLED); no-ops without the key.

Gates

+11 tests (entitlement matrix + scoring ceilings incl. budget/call-cap/TTL proofs). Full suite 414/414. build clean, validate-routes 31, validate-dist 512. Both UI states verified in preview, no console errors.

Your manual checklist

  • Apply the gated migration migrations/20260616210000_agent_access_seats.sql (Supabase SQL editor)
  • In Stripe: create the per-seat add-on product with graduated pricing (unit 1 = $39, units 2+ = $29), monthly + annual variants → Payment Links
  • Netlify env: AGENT_ACCESS_ADDON_PRICE_IDS (comma-sep monthly,annual price IDs), AGENT_ACCESS_CHECKOUT_URL_MONTHLY, AGENT_ACCESS_CHECKOUT_URL_ANNUAL
  • To turn on scoring later: AGENT_SCORING_ENABLED=true (Anthropic key already set); optional AGENT_SCORING_DAILY_BUDGET_USD / AGENT_SCORING_MAX_CALLS
  • Add the add-on to /pricing.html

🤖 Generated with Claude Code

…coring

PAID ADD-ON (spec §11b + Mary's 'allow monthly too'):
- migration: mp_users.agent_seats (gated). Seats = paid agents = active-token cap.
- lib/agent-entitlement.js: any active premium tier can buy; institutional =
  unlimited; seats>0 = eligible. $39 first / $29 each additional (Stripe graduated).
- resolveAgentOwner returns agentAccess; tokens-create gates on it (402 upsell)
  + caps active tokens at paid seats; read middleware re-checks per request
  (lapsed add-on -> 403, fail-OPEN on lookup blip so paying users aren't locked out).
- stripe-webhook: add-on subscription quantity -> agent_seats; cancel -> 0.
  New env AGENT_ACCESS_ADDON_PRICE_IDS (monthly+annual).
- ai-integrations UI: members without the add-on see an upsell ($39/mo + annual
  Stripe checkout links from env); members with it see the wizard + 'Using N of M
  seats'. 402 backstop. Verified both states in preview, no console errors.

COST-SAFE SCORING (Claude, your existing Anthropic key — no Gemini/OpenAI):
- lib/agent-score-batch.js scores each opp ONCE (no user×opp blowup), Haiku,
  max_tokens 256, input truncated, TTL skip (7d), PER-RUN call cap + DAILY USD
  ceiling that halt the run, heuristic per-user personalization (no extra LLM).
  Flag-gated AGENT_SCORING_ENABLED; no-op without ANTHROPIC_API_KEY.

Tests: +11 (entitlement matrix + scoring ceilings incl. budget/call-cap/TTL).
Full suite 414/414. build clean, validate-routes 31, validate-dist 512.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploy Preview for curious-pony-0dec76 ready!

Name Link
🔨 Latest commit 4d83c83
🔍 Latest deploy log https://app.netlify.com/projects/curious-pony-0dec76/deploys/6a3202431915db00080849f6
😎 Deploy Preview https://deploy-preview-104--curious-pony-0dec76.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (🟢 up 1 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

…icing steps)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant