AgentSDK is the TypeScript developer toolkit for integrating autonomous payment capabilities into AI agents. Register agents, manage wallets, enforce spending rules, and track every transaction — without building payment infrastructure from scratch.
import { SapiomAgent } from '@agentsdk/core';
const agent = new SapiomAgent({
name: 'support-agent-01',
wallet: { balance: 500, currency: 'USD' },
policies: [
{ type: 'rate_limit', maxCalls: 120, per: 'minute' },
{ type: 'spend_cap', amount: 2000, per: 'day' },
],
});
agent.on('transaction', (tx) => {
console.log(`${tx.service} — $${tx.amount}`);
});
// Agent is live and spending with full governance
Add AgentSDK to your project with a single npm command.
npm install @agentsdk/coreDefine what your agent can spend, on which services, with what limits.
const agent = new SapiomAgent({
name: 'research-agent',
maxDailySpend: 100,
allowedServices: ['openai', 'twilio', 'aws'],
});Your agent now has a wallet, policy enforcement, and a full transaction log — built in.
agent.transact('openai', 0.003)
.then(tx => console.log('done:', tx.id));Register agents with named identities, tied to your organization. Each agent gets a unique ID, a spending history, and a configurable policy set.
Agent.create({ name, orgId, policies })Fund agent wallets, track balances in real time, and handle top-ups. Multi-currency support with automatic conversion. Balances update with every transaction.
wallet.balance // { USD: 342.12, EUR: 0 }Rate limits, spend caps, service allowlists, and custom rules. Policies are enforced server-side — agents cannot bypass them, even if compromised.
policies: [{ type: 'spend_cap', amount: 500 }]Every payment, refund, and authorization is recorded with full metadata. Query the ledger with filters: agent, service, time range, amount threshold.
ledger.query({ agentId, since: '24h' })Pre-built integrations with Twilio, AWS, OpenAI, and 40+ more services. Each service entry has pricing models, rate limits, and SDK helpers. Add your own in minutes.
catalog.use('twilio', { region: 'us-east-1' })Real-time event stream for every agent lifecycle event. Transaction confirmed, policy breached, wallet low, agent paused. Build your own automation layer on top.
agent.on('transaction', handlePayment)Plug AgentSDK into OpenAI's Agents SDK as a tool. One decorator, full payment capability.
Use AgentSDK as a client-side payment module. Full Claude Code integration.
AgentSDK as a LangChain tool or custom LangGraph node. Works with LCEL chains.
CrewAI agent roles with AgentSDK payment capabilities baked in. Multi-agent orchestration.
TypeScript-native agent framework. AgentSDK ships as a first-class Mastra integration.
Don't see your framework? The SDK is framework-agnostic. Any agent that can call a function can pay with AgentSDK.
// Works with anything that supports tool calls
const result = await agent.pay({
service: 'twilio',
amount: 0.08,
description: 'SMS notification',
});Your agent code cannot bypass spending limits. Policies are enforced by the AgentSDK API, not by client-side checks. If the agent is compromised, it still cannot overspend.
The transaction ledger is append-only. Every payment, refund, and authorization creates an immutable record with full context: agent ID, service, amount, timestamp, and metadata.
A policy breach is an error, not a silent override. Failed transactions return structured errors with reason codes. Your agent code decides how to handle them.
The SDK has no heavy dependencies. The full package is under 50KB gzipped. You should understand every line of code your agent runs.
Every agent that needs to pay for a service — Twilio, OpenAI, AWS, a data API, anything — deserves a clean SDK that handles the complexity so you can focus on what the agent actually does.
// One SDK. Every service. Full control.
import { AgentSDK } from '@agentsdk/core';
const sdk = new AgentSDK({ apiKey: process.env.AGENTSDK_KEY });
// Give any agent a wallet and a policy
const agent = sdk.agent({ name: 'my-agent', budget: 1000 });
// It can now pay for anything it needs
await agent.pay('openai', 0.15, { description: 'gpt-4o completion' });