How the pieces fit together.
examples/agent.ts.Morpho (Ethereum mainnet) Robinhood Chain mainnet (4663)
┌───────────────────┐ ┌────────────────────────┐
│ User positions │ │ AUCTRA Credit │
│ (custody) │ │ mintFromYield/spendFrom│
└────────┬──────────┘ └──────────▲─────────────┘
│ GraphQL api.morpho.org │ viem
┌────────▼──────────────────────────────────┴──────────┐
│ backend, yield reader + agent registry + indexer │
└──────────────────────────▲───────────────────────────┘
dApp (Next.js + wagmi)Authenticate with the agent's API key (returned once at creation):
curl -X POST $API/agents/1/spend \
-H "X-Agent-Key: vtr_..." \
-H "Content-Type: application/json" \
-d '{"amountUsd": 2.5, "action": "inference"}'Spends are checked against the agent's budget and maxSpendUsdguardrail, then burned on-chain via spendFrom.
| POST /auth/nonce · /auth/verify | wallet login → bearer token |
| GET /credits/:address | balance + reports + indexed events |
| POST /users/:address/track | start yield tracking (authed) |
| GET /users/:address/positions | live Morpho positions |
| POST/GET/PATCH /agents… | agent CRUD + budget guardrails |
| POST /agents/:id/spend | on-chain debit (owner or API key) |
| POST /agents/:id/task | one AI answer, then on-chain debit |
| POST /agents/:id/revoke-key · /rotate-key | API key lifecycle |
| GET /agents/:id/usage · /agents/usage-summary | spend history + 7d total |
| GET /arena · /services/ai | public leaderboard · task capability |
| Credits | Robinhood Chain mainnet · chain ID 4663 · ETH gas |
| Deposits (Morpho) | Ethereum mainnet · chain ID 1 |
| Morpho API | api.morpho.org/graphql |