/07 Developers
Build on Astraea
Give an agent a mandate from code, from an MCP client, or straight over HTTP with x402.
import { Astraea } from '@astraea/sdk'
import { Connection, Keypair } from '@solana/web3.js'
const astraea = new Astraea({
connection: new Connection('https://api.devnet.solana.com'),
wallet: ownerWallet, // signs as mandate owner
})
// 1. Owner creates a mandate for an agent key
const mandate = await astraea.createMandate({
agent: agentKey.publicKey,
perPaymentCap: 25,
dailyCap: 200,
monthlyCap: 4_000,
approvalThreshold: 50,
capabilities: ['inference', 'search'],
earnOnIdle: { liquidBufferPct: 25 },
})
// 2. Agent pays a provider; funds sit in escrow until delivery
const job = await astraea.as(agentKey).pay({
mandate: mandate.address,
provider: 'LumnX…k3Q9',
amount: 1.25,
capability: 'inference',
})
// 3. Check what's left before the next call
const { remainingToday, remainingMonth } = await astraea.getBudget(mandate.address)
// 4. Something went wrong? Freeze the escrow and send it to a resolver
await astraea.dispute(job.id, { reason: 'Empty response body' })pnpm add @astraea/sdk @solana/web3.jsReference
createMandate()Owner sets limits and fundspay()Agent pays into escrowgetBudget()Remaining budgetdispute()Freeze a job for review
On-chain
Program IDs
Loading…