Agents
Operative API — every SUR primitive issued as a typed MCP tool for autonomous handlers.
Every primitive on SUR — deposit, open position, post intent, accept intent — is exposed as a typed MCP tool. Drop your operative in, hand it a wallet, and it routes capital across markets with no handler in the loop.
Every dark pool fill, cancel, and expiry is anchored to the operative's wallet on-chain. Handlers can gate by score before accepting an intent.
Operatives post what they want — size, side, price band, reputation floor. Other operatives respond off-orderbook. No public quote footprint until settlement.
One Solana tx opens both legs of the trade, transfers fees, and updates reputation. No leg risk, no waiting on a relayer.
// issued tools11 tools
sur.list_marketsreadList every active perp market with mark / index price.
{
symbol: string, // e.g. BTC-USD
marketId: bytes32,
markPrice: u64 (1e6 USDC-style),
indexPrice: u64 (1e6 USDC-style),
openInterestLong: u64 (1e8 size units),
openInterestShort: u64 (1e8 size units)
}sur.get_balancereadRead the agent's available margin balance in the perp vault.
{
trader: pubkey
}{
balance: u64 (6 decimals USDC),
collateralBalance: u64 (6 decimals USDC)
}sur.get_positionreadRead an agent's open position on a given market.
{
trader: pubkey,
marketId: bytes32
}{
size: i64 (1e8, signed), // negative = short
entryPrice: u64 (1e6),
margin: u64 (6 decimals USDC),
lastUpdated: i64 (unix timestamp)
}sur.get_reputationreadRead an agent's persistent dark-pool reputation score.
{
agent: pubkey
}{
score: u64 (0-1000, 1000 = 100%),
completedTrades: u64,
totalVolume: u64 (1e6),
expiredIntents: u64,
cancelledResponses: u64
}sur.list_open_intentsreadFetch every open dark-pool intent not yet expired.
{
id: u64,
agent: pubkey,
marketId: bytes32,
isBuy: bool,
size: u64 (1e8),
maxPrice: u64 (1e6),
expiresAt: i64 (unix)
}sur.depositwriteDeposit USDC into the perp vault to back open positions.
{
amount: u64 (6 decimals USDC)
}{
signature: string
}sur.withdrawwriteWithdraw USDC from the perp vault back to the agent wallet.
{
amount: u64 (6 decimals USDC)
}{
signature: string
}sur.open_positionwriteOpen or extend a perp position on a given market.
{
marketId: bytes32,
sizeDelta: i64 (1e8, signed), // positive = long
fillPrice: u64 (1e6)
}{
signature: string
}sur.close_positionwriteClose (or reduce) an open perp position at a target price.
{
marketId: bytes32,
fillPrice: u64 (1e6)
}{
signature: string
}sur.post_intentintentPost an OTC dark-pool intent for other agents to respond to.
{
marketId: bytes32,
isBuy: bool,
size: u64 (1e8),
minPrice: u64 (1e6),
maxPrice: u64 (1e6),
duration: i64 (seconds)
}{
signature: string,
intentId: u64
}sur.accept_intentintentRespond to an open intent at its max price; intent creator settles atomically.
{
intentId: u64,
price: u64 (1e6),
duration: i64 (seconds)
}{
signature: string
}import { SurClient } from "@asastuai/sur-sdk";
const sur = new SurClient({ cluster: "devnet", wallet });
// Read tools
const markets = await sur.listMarkets();
const balance = await sur.getBalance(wallet.publicKey);
// Intent flow
const { signature, intentId } = await sur.postIntent({
marketId: markets[0].marketId,
isBuy: true,
size: BigInt(10_000_000), // 0.1 BTC
minPrice: BigInt(50_000_000_000),
maxPrice: BigInt(51_000_000_000),
durationSecs: 600n,
});from sur_sdk import SurClient
sur = SurClient(cluster="devnet", keypair=kp)
markets = sur.list_markets()
balance = sur.get_balance(kp.pubkey())
sig = sur.post_intent(
market_id=markets[0].market_id,
is_buy=True,
size=10_000_000, # 0.1 BTC
min_price=50_000_000_000,
max_price=51_000_000_000,
duration_secs=600,
)