Product Guide
Every surface, what it does, how to use it, and where its limits are. Source on GitHub
The complete functional reference for Protocol Bank: every surface, what it does, how to use it, and where its limits are. This guide describes behavior — it does not repeat the PRD (spec & milestones), the Go-Live checklist (step-by-step operations), the MCP docs (integration), or the threat model (security limits). Those are linked, not duplicated. Last updated: October 2026.
0. One-paragraph product
Protocol Bank is the control plane for agent commerce. One credential gives an agent a mandate the server enforces across commerce, payments, cards and trading — which operations (read/trade/pay/swap), a per-call cap, a daily cap, an allowlist, budgets and audit. Commerce orders bind a seller, amount, token and termsHash; pay can execute from the payer's signed EIP-3009 authorization or x402; cards are coming soon and will be agent-scoped and provider-issued; trading runs through a trading-only Hyperliquid wallet (EIP-712 approveAgent) that can place and cancel orders and can never withdraw. The cockpit is a paper demo of one rail; the API is the product.
Positioning & milestones → PRD_V3_AGENT_COMMERCE.md and PRD_V2_AI_TRADING.md
1. Surfaces at a glance
| Surface | Route | Purpose |
|---|---|---|
| Landing | / | Control plane for agent commerce; sandbox and API CTAs |
| Agent API | /agent-api | The product: mandate, commerce, payments, wallet, trading (cards coming soon) |
| Agent Commerce | /agent-commerce, /api/v1/agent/commerce/* | Directory + services, quotes, orders, delivery proof, disputes, refunds, reputation |
| Docs | /docs, /zh/docs | Overview, quickstart, concepts, API, security (EN/中文) |
| Pricing | /pricing | Plans, caps, per-order fee |
| Demo cockpit | /trading | A paper agent the same API drives |
| Live track record | /live-track-record | Public, anonymized real-money performance |
| Usage guide | /help | B2B onboarding & FAQ |
| Settings | /settings | API keys + policy, AI model, billing, team, webhooks |
| API keys | /settings/api-keys | Create keys, set/edit the server-enforced policy |
| Media kit | /media-kit | Logos, boilerplate, brand rules |
| MCP server | local stdio / hosted | Control the account from Claude / any MCP host |
| Admin analytics | /admin/analytics | Internal: users, usage, feedback |
2. The Agent API (the product)
One credential gives an agent a commerce, payments and trading account; cards are coming soon under a mandate the server enforces. Five execution endpoints; orders executes through the trading wallet, pay executes only when the caller supplies a signed authorization, and commerce runs under /commerce/*. The cockpit in §3 is one rail's demo.
2.1 The key and the policy
Settings → API Keys. A policy carries allowedOps (read/trade/pay/swap), maxNotionalUsd, dailyCapUsd and allowedCoins. Values are clamped; the agent cannot widen them. New keys start read-only ($50/call, $200/day); the owner edits the policy and it applies on the next call.
2.2 Endpoints
| Endpoint | Operation | Executes? |
|---|---|---|
GET /api/v1/agent/state | read | — |
POST /api/v1/agent/orders | trade | yes (trading-only wallet) |
POST /api/v1/agent/pay | pay | optional: executes with a signed EIP-3009 authorization (EVM USDC) |
POST /api/v1/agent/swap | swap | no (quote to sign) |
POST /api/v1/agent/invoice | pay | no (pending invoice + paymentLink) |
Two envelopes act on a trade: the key policy (403 on a violation) and the platform risk envelope (positions, leverage, stop-loss, daily breakers; 409 on a refusal). A refusal is final for the request. pay is metered against the daily cap but carries no per-order fee; a used EIP-3009 nonce answers 409. Full reference: AGENT_API.md and the served contract at /api/agent.openapi.json.
The commerce endpoints live under /api/v1/agent/commerce/*: services, quotes, orders, delivery proof, disputes, refunds and reputation. The order stores a canonical termsHash; pay accepts orderId and binds the payment to the order's seller, amount and token. Escrow is not live yet; payment is direct. Full reference: AGENT_COMMERCE.md.
2.3 Sandbox and live
Paper mode uses real market data and simulated fills; the ledger persists per wallet. Approve the agent wallet on Hyperliquid and the same endpoints switch to live mode without a code change. The wallet has trading-only rights: place and cancel orders, never withdraw.
2.4 Plans and billing
Sandbox is free. Builder $199/mo, Growth $999/mo, Scale from $4,999/mo; without a plan, executed orders are billed at 8 bps of notional, invoiced monthly. A paid plan replaces the per-order fee and sets the ceiling the key policy may ask for. → /pricing.
2.5 Clients
HTTP, the MIT TypeScript SDK, the framework tool manifest (Vercel AI SDK, LangChain, Mastra, elizaOS), the hosted MCP server and the stdio MCP proxy. Docs: /docs (EN), /zh/docs (中文). Open client: github.com/everest-an/protocolbanks-sdk.
3. The demo cockpit (/trading)
This is the demo: a paper agent the same API drives. Production integrations call the API in §2; the cockpit exists so a developer can watch the account behave before wiring anything.
The single source of truth for the demo account. Data comes from GET /api/trading/overview and refreshes every 15s (SWR).
3.1 Status & account cards
| Card | Shows | Notes |
|---|---|---|
| Mode badge | Paper Trading / Live | Reflects the agent's mode |
| Total Assets | Equity | Main + trading wallet |
| Main Wallet | Your untouched wallet | "AI can never touch this" |
| Trading Wallet | Trading budget | "Max you can lose: $X" — the risk model in one line |
| All-time Profit | Realized + unrealized PnL | Red/green; also hosts Withdraw Profit and Share my PnL |
3.2 Equity curve
7D / 30D views over state.equity (one point per day, plus intraday points after trades). Fresh paper accounts start with a 30-day demo history — see §4.3.
3.3 Positions
Every open position lists side, leverage, size, entry/mark, unrealized PnL, and a plain-language reason ("momentum z=-1.5, funding +0.001%/h, short bias").
3.4 Activity feed ("What the AI is doing")
Append-only, newest first: market scans, entries (with reason), exits (with PnL), and risk-guard events ("Risk engine: daily loss at 5% — no new entries today"). This is the transparency surface — the answer to "why did it do that?"
3.5 Controls
| Control | Effect |
|---|---|
| Pause AI / Resume AI | Stops/starts *new entries*; open positions keep being managed (stop-losses stay live) |
| Emergency Stop | Halts everything (no new entries; exits still enforced by risk on resume) |
| Reset paper account | Paper only: clean $500 slate, no demo history |
| Entry mode (see §5) | Toggle Automatic ↔ Manual approval |
| Withdraw Profit | Sweeps available profit back to your main wallet (live only) |
| Share my PnL | Copies an honest share card (live = real PnL + track-record link; paper = clearly labelled simulated) |
3.6 Go Live card
Wallet approval lifecycle: Create (generates + encrypts the agent key) → Sign (MetaMask approveAgent) → Approved. Revoke removes local key material; on-chain revocation happens on Hyperliquid.
Operations detail → GO_LIVE_CHECKLIST.md
4. Paper engine
4.1 Strategy
Two signals, combined into one score:
| Signal | What it reads | Why |
|---|---|---|
| Momentum | 24h z-score of closes | Trend continuation, risk-adjusted |
| Funding carry | Perp funding rate | Collects the crowd's positioning bias |
Executed over the 12 most liquid Hyperliquid perps. Long/short.
4.2 Risk parameters (defaults)
| Parameter | Value |
|---|---|
| Position size | 15% of trading equity per position |
| Max concurrent positions | 3 |
| Take-profit / stop-loss | +30% / -15% per position |
| Daily circuit breakers | 5% → no new entries; 8% → close everything |
| Leverage (paper model) | 2× |
| Costs modelled | Taker fee 0.04% + slippage 0.05% per side |
| Tick cadence | ~15s (also tick-on-demand when the cockpit is open) |
Entries require |score| above a threshold; exits trigger on TP, SL, signal fade, or the daily kill switch.
4.3 Demo history (fresh paper accounts)
A brand-new paper account seeds a deterministic 30-day equity curve (with a mid-window drawdown, ending ~+4%) so first-time visitors immediately see what the agent does. It is generated locally and labelled in the activity feed: *"Simulated demo history — not real trading results."* An explicit Reset gives a clean $500 slate instead. Demo history is never carried into live ledgers (§6.2).
4.4 Persistence
Paper state lives per wallet: in-memory → file store (.data/ or /tmp) with a fire-and-forget write-through to TradingAccount.state_json so progress survives serverless restarts. A cold start restores the last ledger from state_json (mode-guarded: paper state can never overwrite live), and paper fills are written to trade history like live ones — only the notifications stay live-only.
5. Manual approval mode
What it is: an opt-in entry gate. In manual mode the agent does not place entries by itself; when a signal fires it creates a pending trade (symbol, side, price, reason) and waits.
- Approve → the agent re-prices at the current market and **re-runs
every risk limit** before placing the order. A stale signal can never bypass the risk engine.
- Reject → nothing is placed.
- **Exits (stop-loss, take-profit, signal fade, circuit breaker) always run
automatically in both modes** — approval gates entries only, never safety.
Where: cockpit control card ("Entry mode") · API POST /api/trading/actions {action:"set_approval", mode:"auto"|"manual"}, plus approve / reject · MCP control_trading_agent.
Switching back to auto discards any waiting trade.
6. Live mode
6.1 The authorization flow
- Fund Hyperliquid (Arbitrum bridge). First run: $50–100.
- Create the agent wallet (server generates a keypair; AES-256-GCM encrypted).
- Sign
approveAgentin MetaMask → on-chain, trading-only, revocable.
What you sign grants: place/cancel orders on your account. It does not grant withdrawals. That separation is the entire safety model.
6.2 Promotion to a live ledger
A wallet is promoted from paper to live when its account row says status = live and agent_approved. On first promotion the ledger is rebuilt as a clean live book: the demo history is dropped (simulated data must never back a live account), and the budget comes from the account row.
6.3 Order execution
Live entries and exits are real IOC orders signed by the agent key. Responses are translated into three states:
| State | Meaning | Engine behavior |
|---|---|---|
| ok | Filled — real avgPx + size returned | Position recorded at the exchange fill |
| rejected | The exchange definitively refused (e.g. insufficient margin) | Logged as a guard event; nothing recorded |
| uncertain | Timeout / reset / unparseable body / unexpected resting order | Agent halts itself. No retry. Position book untouched. Owner notified to verify on Hyperliquid, then resume |
The uncertain rule exists because a retry after an ambiguous response can open a duplicate position with real money. We prefer "stop and ask" over "risk a double fill". Rationale & limits → SECURITY_THREAT_MODEL.md §3.1–3.2
6.4 Known drift
The agent keeps its own book rather than reading the exchange portfolio every tick. Manual trades you make in the Hyperliquid UI, or an uncertain fill, can leave the book out of sync. GET /api/trading/live/state shows the real Hyperliquid account in the cockpit for comparison.
7. Live track record (/live-track-record)
The public trust asset. Reads GET /api/trading/track-record (public, no auth):
- Aggregate: live account count, total budget, total realized PnL.
- Per account: anonymized id (stable 8-hex FNV hash of the wallet), name,
budget, trade count, realized PnL.
- Wins and losses both shown — no cherry-picking.
- Honest empty state before the first live account exists.
Wallet addresses and keys are never exposed.
8. MCP server
Lets Claude Desktop / Claude Code / any MCP host read and control the agent: get_trading_overview, get_positions, get_activity, get_track_record, control_trading_agent (pause/resume/stop/approve/reject/set_approval).
Auth: guest mode (no token) is read-only against the demo + public data; MCP_AUTH_TOKEN + MCP_WALLET_ADDRESS unlock the caller's own account. The MCP layer never touches key material.
Setup & tool reference → MCP.md
9. Feedback & support
| Channel | Where |
|---|---|
| In-app report | Floating Report an issue button (every product page) → emails the team |
| e@awareness.market | |
| Discord | https://discord.gg/aBeZEsfXkH (linked in footer, landing CTA, report dialog) |
10. Pricing
| Plan | Price | Keys | Per call / day |
|---|---|---|---|
| Sandbox | Free | 1 | $50 / $200 |
| Builder | $199/mo | 3 | $500 / $5,000 |
| Growth | $999/mo | 10 | $2,500 / $50,000 |
| Scale | from $4,999/mo | 100 | $10,000 / $100,000 |
Without a plan: 8 bps of executed notional, invoiced monthly. Paid plans replace the per-order fee and set the ceiling the key policy may ask for. Details and checkout: /pricing.
11. Business suite (payments)
The payment-era surfaces remain available but are deliberately de-emphasized — the company's focus is the agent execution product, and several of these surfaces are hidden from the current navigation (their URLs still resolve). Custody differs per feature and is stated explicitly: "non-custodial" is only true where it is true.
Non-custodial — the platform never holds the funds
| Surface | What it does | How funds move | Proven |
|---|---|---|---|
Batch payments (/batch-payment) | Excel/CSV import, address validation, per-item execution with progress + retry | Each payout is an EIP-3009 transferWithAuthorization signed by the payer; a relayer only submits and pays gas. If any item on an EIP-3009 chain is unsigned the batch is refused — no silent custody fallback | E2E on Sepolia: payer balances move, relayer balance unchanged |
Send / Pay (/send, /pay) | Direct transfers | The user signs the transfer in their own wallet; the platform only displays it | UI flows covered by E2E |
Swap / Bridge (/swap) | Cross-chain quotes (Rango, ZetaChain) across 50+ chains | The user signs; the platform never holds | Endpoints answer; providers config-gated, refusals are clean |
Split payments (/split-payments) | One payment split across recipients | EIP-3009 authorizations signed by the payer | Calculate / templates / create verified; execution pending |
| x402 | Machine payments over HTTP 402 for AI agents | The payer signs an EIP-3009 authorization; a relayer only submits and pays gas. An audit-era paywall bypass (any 64-hex string accepted as proof) was found and fixed | Verified with the local relayer, on-chain |
Subscriptions (/subscriptions) | Recurring charges | Charges are pre-signed EIP-3009 authorizations, submitted by the app (a hosted relayer is optional) | Verified with the local relayer |
Provider-custodied — a provider holds the balance
| Surface | What it does | Why it is custodial | Status |
|---|---|---|---|
Cards (/card) | Virtual cards funded from the wallet | Issued through a provider (Yativo; a Rain client is also implemented) that holds the card balance | Yativo credentials await the provider's account approval; Rain awaits RAIN_API_KEY + KYB |
Off-ramp (/offramp) | Sell crypto for fiat (Bridge / Coinbase / Transak) | Provider-executed settlement | Without a provider key the surfaces answer 503 — no fabricated mocks |
Read-only / infrastructure — no custody at all
Balances, history, analytics, reconciliation, vendors (address book), payment groups, webhooks, notifications, audit log, teams, MCP server, cron jobs.
Enterprise hardening applies across the suite: Row-Level Security, per-user scoping on every authenticated route, request signing, replay protection, and the fourteen audit fixes (cross-tenant reads, wrong-chain fallback, error-semantics bugs) — see FEATURE_REVIEW.md.
12. Settings & the Agent API
Settings lives at /settings; the two entries that matter for programmatic use are API Keys (/settings/api-keys) and AI Model (/settings/ai-model). Every key carries a policy the server enforces on each call, so the same credential can be exposed to a third-party or model without handing over the account.
12.1 API keys and the policy
| Field | Meaning | New key |
|---|---|---|
allowedOps | read, trade, pay, swap — which calls the key may make | ["read"] |
maxNotionalUsd | Per-call cap | $50 |
dailyCapUsd | Per-UTC-day cap, summed from metered calls | $200 |
allowedCoins | Allowlist; empty means every supported market | empty |
Permissions are a second gate: read covers GET /state, write covers orders, pay, swap and invoice. The create dialog sets both; the key's row shows the policy and opens an editor. Values are clamped server-side, and a key created before policies existed is marked legacy defaults (all four ops, $100/call, $500/day) until someone edits it.
12.2 The Agent API
Five execution endpoints under /api/v1/agent/*; commerce lives under /commerce/* and is documented in AGENT_COMMERCE.md:
| Endpoint | Operation | Executes? |
|---|---|---|
GET /state | read | — |
POST /orders | trade | yes (agent wallet, trading-only) |
POST /pay | pay | no — returns an intent to sign |
POST /swap | swap | no — returns a quote to sign |
POST /invoice | pay | no — pending invoice + paymentLink |
/commerce/* | pay | no — order state; payment is a separate pay call |
orders executes through the trading-only wallet; pay executes when the caller supplies a signed EIP-3009 authorization; swap returns a quote to sign; invoice is a payment request the payer settles through the returned link (read it back with GET /api/invoice?id=…&sig=…). Commerce orders bind the payment to the seller, amount, token and termsHash.
Walk it with one command: PB_KEY=pb_… pnpm example:agent (add --invoice). The machine-readable contract is api/agent.openapi.json; check it offline with node scripts/verify-openapi.mjs.
Framework tools. @everestan/protocolbanks-agent-tools exports the five operations as JSON Schema tool definitions with OpenAI/Anthropic converters, so one manifest feeds the Vercel AI SDK, LangChain or a hand-rolled loop. Only place_order executes, and the tool descriptions tell the model not to retry a refusal — see AGENT_TOOLS.md.
13. Documentation map
| Doc | Covers |
|---|---|
| PRD_V2_AI_TRADING.md | Product spec, scope, milestones (ZH) |
| GO_LIVE_CHECKLIST.md | Step-by-step first live run + troubleshooting |
| SECURITY_THREAT_MODEL.md | Assets, trust boundaries, known limitations |
| MCP.md | MCP setup and tool reference |
| AGENT_API.md | Agent API: auth, mandate, execution + commerce + wallet, errors, billing |
| AGENT_COMMERCE.md | Commerce: services, quotes, orders, delivery proof, payment binding, reputation |
| Agent API contract | OpenAPI 3.1 for the execution + commerce paths — policy schema, error classes, real examples |
| ESCROW_DESIGN.md | Design-only escrow contract, roles, interface and legal limits |
| AGENT_CASES.md | Four worked technical cases (framework tool, invoices, x402, runaway limits) |
| AGENT_TOOLS.md | The tool manifest and adapters for the Vercel AI SDK, LangChain, OpenAI and Anthropic |
| PARTNERS.md | Partner integration guide (curl, SDK, sandbox, per-order billing) |
| ARCHITECTURE.md | System architecture |
| AUTH_SYSTEM.md | SIWE + JWT, Shamir, sessions |
| TESTING_GUIDE.md | Jest, Playwright, property tests |
| ../README.md | Repo front door |
| Open client (MIT) | SDK, tool manifest, MCP proxy and framework starters |

