TypeScript SDK
Give your agent wallets, payments and spending controls
The Agentis SDK connects your application or agent runtime to hosted wallets, token transfers, paid APIs, spending policies and transaction receipts. It uses the same permissions and approval flow as the dashboard, CLI and MCP.
Install
bun add @agentis-hq/sdkCreate a client
Create an access key from your agent's API access panel and store it in your runtime's environment. Choose the networks that key should access.
import { AgentisClient } from '@agentis-hq/sdk'
const client = new AgentisClient({
baseUrl: 'https://api.agentis.systems',
token: process.env.AGENTIS_TOKEN!,
})An agent key can request payments within its scope. It cannot approve its own payments, change spending rules or export wallet keys. Use a separate owner-authenticated client for administration.
token also accepts a function returning a string or a promise, useful for fetching a fresh owner access token. An optional fetch implementation can be supplied for your runtime. Do not add automatic retries around payment requests.
Make your first payment
This example requests a 1 USDC transfer from an enabled Base wallet. Set RECIPIENT_ADDRESS to the intended recipient. Amounts and fee caps are atomic-unit strings.
const wallets = await client.wallets.list()
const wallet = wallets.find(item => item.enabled && item.chainId === 'eip155:8453')
if (!wallet) throw new Error('Enable Base and give this key access to its wallet')
const operation = await client.operations.create({
walletId: wallet.id,
action: 'transfer',
chainId: wallet.chainId,
asset: 'erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
to: process.env.RECIPIENT_ADDRESS!,
amountAtomic: '1000000', // 1 USDC
maxFeeAtomic: '100000000000000', // 0.0001 ETH fee budget
reason: 'Requested transfer',
}, { idempotencyKey: 'transfer-invoice-001' })
if (operation.status === 'pending_approval') {
// Present operation.approvalUrl to the owner and wait for their decision.
} else if (['queued', 'submitting', 'submitted'].includes(operation.status)) {
const result = await client.operations.wait(operation.id)
// Inspect result.status and result.receipt before reporting completion.
}The wallet must have the payment asset and enough gas. Ask mode returns an approval link; Auto follows the agent's limits without an additional Agentis approval. Your application generates and persists one idempotency key per intended payment. Reuse that key and exact request after a lost response; see retry behavior.
Guides
| Task | Guide |
|---|---|
| Find wallets, read balances and inspect spending limits | Wallets and balances |
| Send tokens, discover services and pay x402/MPP APIs | Transfers and paid APIs |
| Handle approvals, wait for settlement and read results | Operations and errors |
| Create agents, configure rules and manage access keys | Owner administration |
| Quote swaps, rebalance, schedule DCA and use ENS | Uniswap and ENS |
| Build a shopping cart or attach browser checkout | Card purchases |
API groups
| API | Purpose |
|---|---|
client.wallets | Wallet listing, policy reads and owner wallet administration |
client.agents | Agent balances and owner settings |
client.operations | Transfer requests, approval decisions, status and receipts |
client.fetch | Paid HTTP requests through x402 or MPP |
client.discovery | Public service search and details |
client.history() | Payment history within the caller's wallet/network scope |
client.capabilities() | Available networks, payment protocols and plugins |
client.grants | Owner-managed access keys |
client.profile | Owner account spending summary |
client.uniswap | Quotes, swaps, rebalancing and schedules |
client.identity | ENS resolution, identity setup and delegated records |
client.cards | Card connection, permissions and purchase requests |
client.cliLogin, client.oauth | Browser consent integration for CLI and MCP clients |
The SDK exports TypeScript request/response types such as Operation, OperationInput, AgentisWallet, AgentSettings, FetchRequest and AgentisApiError. Hosted signing and budget enforcement happen in the backend; the SDK does not hold wallet private keys.