Platform architecture
How identity, direct payments, living entitlements, and bounded agent spending fit together.
System overview
Bagseven has two public interfaces: the website and documentation, and the signed-in provider console. Applications integrate through the entitlement API and SDK. Assistants connect to the MCP adapter. Server services coordinate access and spending; email and wallet prove account control; Avalanche contracts settle payments, enforce mandate caps and account for entitlements.
| Component | Local port | Responsibility |
|---|---|---|
| Website and docs | 3001 | Public product site and documentation. |
| Console and BFF | 3000 | email and wallet sign-in, wallet approval interfaces, and session-scoped server proxies. |
| Entitlements daemon | 4001 | Grants, checkout verification, SDK APIs, worker operations, and payment orchestration. |
| Gateway | 4000 | Authenticated proxy for the console’s policy requests. |
| Policy service | 4003 | Signed mandate creation, agent registration, spending checks, and reservations. |
| MCP adapter | 4009 | Assistant tools and email and wallet-gated OAuth. Forwards tool operations to the daemon. |
Follow a request
Use credits the customer has already paid for. No new USDC transfer and no funded mandate required.
- 01Application or agentSDK request or MCP paid_run
- 02DaemonAuthenticate and check holder / worker scope
- 03Registry grantCheck enabled, expiry, and credit balance
- 04Consume creditsMeter the feature with an idempotency key
- 05Feature accessYour service honors the access result
Prepaid consumption uses service credits. A new agent payment spends USDC. Only the new payment path needs on-chain spending authority; credit units are not USDC amounts.
Service connections
| Caller | Route | Why |
|---|---|---|
| Browser dashboard | Console BFF → daemon | Read and manage entitlements and checkout using a signed-in session. |
| Browser dashboard | Console BFF → gateway → policy | Discover and manage owner-scoped spending permissions. |
| Your backend or SDK | Daemon public /v1 API | Check access, consume credits, and create customer checkout. |
| Assistant | MCP → daemon | Use tools without exposing daemon credentials to the assistant. |
| Daemon payment path | Policy authorization → daemon executor → Avalanche | Obtain spending authorization, execute within mandate rules, and settle reservations. |
The daemon calls policy directly on the internal service connection. The gateway is the dashboard’s authenticated policy entry point; it is not the public entitlement API.
Where state lives
| System | State and authority |
|---|---|
| email and wallet | Inbox and wallet control. The platform verifies the email and wallet signature before issuing its session. |
| Avalanche | USDC transfer receipts, deployed mandates, vault balances, revocation, and worker spending limits. |
| Registry | Living entitlement records, remaining credits, paid_through, and renewal preference. |
| PostgreSQL | Platform records such as plans, checkout sessions, mandate metadata, agent trees, reservations, and transaction references. |
| Redis | Request idempotency, payment claims, request state, and service coordination where configured. |
| MCP + PostgreSQL | OAuth codes, access/refresh tokens and consent attempts persist in PostgreSQL. HTTP transports are stateless per request. |
Database mandate records are not proof of deployment. The platform reads the configured chain before presenting live capacity. If the contract is missing or unavailable, spending is disabled rather than trusting a stale active flag.
Failures and practical limits
Expired or exhausted grants deny new usage. Cancel renewal preserves the paid period. A missing deployment, inactive worker, or exceeded contract limit denies a new agent payment.
Do not resend an uncertain payment or deployment just because the client timed out. Check receipts and existing records first. The payment request ledger holds uncertain attempts for reconciliation. Registry operation IDs and durable payment journals protect retries. OAuth state persists in PostgreSQL; each HTTP request has its own transport.
Recurring workers collect explicitly authorized 30-day subscriptions and reconcile paid periods before fulfillment. Provider signing throughput, public-network settlement, backup recovery and load limits still need deployment-specific verification. Cross-L1 messaging is not implemented.