AAgentis Docs

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/sdk

Create 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

TaskGuide
Find wallets, read balances and inspect spending limitsWallets and balances
Send tokens, discover services and pay x402/MPP APIsTransfers and paid APIs
Handle approvals, wait for settlement and read resultsOperations and errors
Create agents, configure rules and manage access keysOwner administration
Quote swaps, rebalance, schedule DCA and use ENSUniswap and ENS
Build a shopping cart or attach browser checkoutCard purchases

API groups

APIPurpose
client.walletsWallet listing, policy reads and owner wallet administration
client.agentsAgent balances and owner settings
client.operationsTransfer requests, approval decisions, status and receipts
client.fetchPaid HTTP requests through x402 or MPP
client.discoveryPublic service search and details
client.history()Payment history within the caller's wallet/network scope
client.capabilities()Available networks, payment protocols and plugins
client.grantsOwner-managed access keys
client.profileOwner account spending summary
client.uniswapQuotes, swaps, rebalancing and schedules
client.identityENS resolution, identity setup and delegated records
client.cardsCard connection, permissions and purchase requests
client.cliLogin, client.oauthBrowser 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.