StableOps

Management SDK

Use the StableOps Agent Payments management SDK in a trusted TypeScript service to configure Agents, wallets, policies, budgets, approvals, and payment queries.

@stableops/agent-payments-api-sdk is the dedicated Agent Payments management client. Run it only in a trusted operator service, never in an Agent runtime or browser bundle.

Install

pnpm add @stableops/agent-payments-api-sdk

Create a management client

The management API key scopes the organization, environment, and product:

import { StableOpsAgentPayments } from '@stableops/agent-payments-api-sdk'

const apiKey = process.env.STABLEOPS_API_KEY?.trim()
if (!apiKey) throw new Error('Missing STABLEOPS_API_KEY')

const management = new StableOpsAgentPayments({
  apiKey,
})
A management API key can change Agents, wallets, policies, and budgets. Never give it to an Agent runtime. The runtime should hold only a restricted Agent Key prefixed with ak_sandbox_ or ak_live_.

Available resources

ResourceMain operations
management.agentsManage Agents, Agent Keys, and immutable policy versions
management.walletsPair, list, bind, and unbind customer-owned wallets
management.budgetsRead or update organization and Agent daily budgets within platform ceilings
management.approvalsRead approval records
management.paymentsFilter or export payments, and read state transitions and settlement receipts

Amount fields use two different units and must not be mixed:

  • Spending-policy and budget fields such as automaticPaymentThresholdAtomic, perPaymentLimitAtomic, agentDailyLimitAtomic, and limitAtomic always use the six-decimal USDC budget unit, so 1000000 always means 1 USDC.
  • Payment, approval, and receipt fields such as maxAmountAtomic use the network token's onchain atomic unit and must be interpreted with assetDecimals. Base and the other six-decimal configurations use 1000000 for 1 USDC.

If a paid service requires BNB Smart Chain, first confirm that it accepts the corresponding asset and complete the Permit2 approval. On that network, a 1 USDC x402 quote and maxAmountAtomic are 1000000000000000000, while the policy per-payment limit and daily budget remain 1000000. StableOps rounds budget usage upward so very small payments still count toward the budget.

Policy versions are immutable; create and explicitly activate a new version to change rules. See the supported scope in the introduction for the complete decimals table.

Filter and export payment usage

The payment query accepts payment and resource states, Agent identity, origin, time range, and the immutable business context attached to an Intent:

const page = await management.payments.listPage({
  status: 'settled',
  resourceStatus: 'response_received',
  workflowId: 'research-weekly',
  toolName: 'market-data',
  purposeCode: 'RESEARCH_DATA',
  costCenter: 'research',
  createdFrom: '2026-08-01T00:00:00.000Z',
  createdTo: '2026-08-31T23:59:59.999Z',
  limit: 50,
})

const csv = await management.payments.exportCsv({
  workflowId: 'research-weekly',
  createdFrom: '2026-08-01T00:00:00.000Z',
  createdTo: '2026-08-31T23:59:59.999Z',
})

CSV exports apply the same filters and are limited to 10,000 rows. StableOps prefixes spreadsheet formula characters in caller-controlled context fields; still treat exports as sensitive financial records.

Agent Keys are shown once

const credential = await management.agents.createKey('agent_...', {
  name: 'production-runtime',
})

if (!credential.secret) throw new Error('The one-time Agent Key was not returned')
console.log(`STABLEOPS_AGENT_KEY=${credential.secret}`) // Print only during secure initial setup.

The API cannot return the plaintext again. Revoke and replace a lost or exposed key.

Make approval decisions in the console

Management API keys may read the approval queue. Approval and rejection are high-risk operations and remain in the StableOps console. The management SDK does not accept dashboard access tokens or expose approval and rejection methods.

See the quickstart for the complete wallet, policy, and payment flow.

How is this guide?

Last updated

On this page