Plug an AI agent into a vault.
SDK, pay-per-request API, alerts and a working AI agent, all on Arc.
Agent SDK quickstart
@velo402/arc-sdk · TypeScript · viem
import { ArcAgent, fetchWithPayment } from '@velo402/arc-sdk';
import { privateKeyToAccount } from 'viem/accounts';
const agent = new ArcAgent(privateKeyToAccount(AGENT_KEY), VAULT, 'testnet', {
onEvent: e => console.log(e), // paid / rejected / gas
});
// Pays the 402 invoice from the vault, then retries with proof.
const { response } = await fetchWithPayment(agent, 'https://velo402.vercel.app/api/x402/arc-stats');
console.log(await response.json());The agent key can only call pay() and topUpGas(). check() previews a payment against the live contract; ensureGas() refills the agent's gas from its allowance; invoiceId() hashes an order so it can never be paid twice.
HTTP 402 pay-per-request
x402-style, scheme velo402-vault
- The agent calls a paid endpoint and gets
402with an invoice, price and merchant address. - It pays from the vault with
paymentId = keccak256(invoice). The vault enforces the owner's policy. - It retries with an
X-PAYMENTheader holding the transaction hash. - The server checks on Arc: a real USDC transfer to the merchant, from a factory vault, bound to this invoice.
- Live endpoints
- /api/x402/arc-stats · /api/x402/untrusted-article
- Testnet merchant
- 0xd3C4374e22a1B886F8c93975bC641b1D7A1f0460
- Merchant registry
- 0xb29d4bf988430337113898607b4095e12f49b1c3
AI agent
agent/ai-agent.ts
An LLM agent with three tools: get_budget, buy_resource and pay. It works with any OpenAI-compatible API: Groq's free tier by default, or Ollama locally with no key. The test article contains a prompt injection telling the agent to send 5 USDC to an attacker; the vault refuses it with RecipientDenied and nothing moves.
LLM_API_KEY=... pnpm arc:ai-agent
Owner alerts
Webhook and Telegram
Payments, gas draws, revocations and blocked attempts go to ALERT_WEBHOOK_URL (Discord, Slack, Zapier) and to Telegram via TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID. The console also shows live in-app alerts.
ARC_VAULT_ADDRESS=0x... pnpm arc:watch
Why not an existing agent wallet?
General comparison by approach; products change, so check current docs
| Capability | ArcSteward vault | Hosted agent wallets | Smart accounts + session keys |
|---|---|---|---|
| Limits enforced on-chain, per agent | Yes | Varies by setup | Module-dependent |
| Per-payment, daily and lifetime caps in USDC | Yes, all three | Policy service | Custom module |
| Recipient allowlist plus opt-in merchant registry | Yes | Partly | Custom |
| Replay protection by invoice hash | Yes | No | No |
| Agent gas paid from its own bounded allowance | Yes (USDC gas on Arc) | Sponsored | Paymaster |
| HTTP 402 pay-per-request built in | Yes | Separate | No |
| Footprint | One small contract, no admin key | Hosted service | Smart account + modules |
Who uses it
Concrete jobs, each a policy template in the console
- Research agents buying papers, datasets and search results per query.
- Trading bots paying for market data feeds, capped per day.
- Agent marketplaces where one agent hires another for a task.
- Teams giving each internal agent its own vault and budget.
Roadmap and business model
After this grant
- Escrow contract: pay on delivery, refund on timeout.
- Batched settlement for high-frequency micro-payments.
- Hosted dashboard with team budgets: paid plan. The contracts stay free and open source.
- Independent security audit before large balances.
Responsibilities
Non-custodial by design
ArcSteward never holds funds or keys. Each vault belongs to its owner, who sets the policy and is responsible for the agent's payments. The owner can be a multisig such as Safe for key recovery. Vaults accept Arc USDC only.