Skip to content
Platform documentation
Platform architecture
Core concepts

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.

ComponentLocal portResponsibility
Website and docs3001Public product site and documentation.
Console and BFF3000email and wallet sign-in, wallet approval interfaces, and session-scoped server proxies.
Entitlements daemon4001Grants, checkout verification, SDK APIs, worker operations, and payment orchestration.
Gateway4000Authenticated proxy for the console’s policy requests.
Policy service4003Signed mandate creation, agent registration, spending checks, and reservations.
MCP adapter4009Assistant 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.

  1. 01Application or agentSDK request or MCP paid_run
  2. 02DaemonAuthenticate and check holder / worker scope
  3. 03Registry grantCheck enabled, expiry, and credit balance
  4. 04Consume creditsMeter the feature with an idempotency key
  5. 05Feature accessYour service honors the access result
Authority: the living entitlement and its remaining service credits.
Two different kinds of usage

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

CallerRouteWhy
Browser dashboardConsole BFF → daemonRead and manage entitlements and checkout using a signed-in session.
Browser dashboardConsole BFF → gateway → policyDiscover and manage owner-scoped spending permissions.
Your backend or SDKDaemon public /v1 APICheck access, consume credits, and create customer checkout.
AssistantMCP → daemonUse tools without exposing daemon credentials to the assistant.
Daemon payment pathPolicy authorization → daemon executor → AvalancheObtain 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

SystemState and authority
email and walletInbox and wallet control. The platform verifies the email and wallet signature before issuing its session.
AvalancheUSDC transfer receipts, deployed mandates, vault balances, revocation, and worker spending limits.
RegistryLiving entitlement records, remaining credits, paid_through, and renewal preference.
PostgreSQLPlatform records such as plans, checkout sessions, mandate metadata, agent trees, reservations, and transaction references.
RedisRequest idempotency, payment claims, request state, and service coordination where configured.
MCP + PostgreSQLOAuth 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.

Trust and signing boundaries

The browser holds its application session and uses the selected wallet connector for owner signatures and wallet-approved transactions. Secret API keys, daemon tokens, and configured private signers remain on the server.

RoleAuthority
HumanApproves email and wallet verification and wallet ownership.
Mandate ownerSigns fixed terms and delegation; approves funding, withdrawal, and revocation in the wallet.
Provider gas signerThe authorized dedicated account pays operating AVAX under server-enforced budgets. Gas authority is separate from payer payment authority.
Agent operatorIdentifies the registered worker and signs its spending intent.
Executor / enforcerSubmits authorized spending transactions; the contract still enforces its limits.
ProviderReceives customer USDC directly and delivers the entitled service.

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.

Current deployment model

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.

Registry authority and scaling limits

BagEntitlementRegistry uses direct mappings and atomically checks expiry, credits and duplicate operation IDs. PostgreSQL narrows private discovery before bounded parallel contract reads. Raw billing emails stay off-chain; subject HMACs require the same ENTITLEMENT_SUBJECT_SECRET across restarts and deployments.

The provider signer is trusted to issue and operate its grants. The contract enforces provider/operator authority and credit accounting; it does not independently prove that a checkout payment occurred. The daemon verifies settlement and holder/worker authorization.

Measure throughput before promising scale

Consumption currently writes to Avalanche and waits for confirmations. This incurs gas, RPC latency and signer nonce contention. Indexed discovery and bounded workers are implemented; load-tested production throughput, recovery targets and cross-L1 delivery are separate requirements.

Bagseven documentationemail and wallet · Avalanche · Registry