Skip to main content

Overview

The Cashmere Agent SDK (cashmere-agent-sdk) turns cross-chain USDC transfers into a standard AI agent tool. Any framework that supports function calling or tool use can integrate Cashmere bridging in minutes. What agents can do:
  • Simulate a transfer to preview fees, duration, and route viability without executing
  • Execute a transfer across 16 chains (EVM, Solana, Aptos, Sui)
  • Query supported routes and CCTP versions programmatically
Destination minting is handled automatically by Cashmere relayers — the agent only needs to initiate the source-side burn.

Install

npm install cashmere-agent-sdk
For LangChain integration, also install:
npm install @langchain/core

Quick Setup

import { CashmereCCTP } from 'cashmere-agent-sdk';

const cctp = new CashmereCCTP({
  evm: { privateKey: process.env.EVM_PRIVATE_KEY },
  solana: { privateKey: process.env.SOLANA_PRIVATE_KEY },
  aptos: { privateKey: process.env.APTOS_PRIVATE_KEY },
  sui: { privateKey: process.env.SUI_PRIVATE_KEY },
});
Only configure the chains your agent needs. Keys are read from environment variables and used only for in-memory transaction signing.

Simulate Before Execute

Use simulate() to let the agent preview costs before committing funds:
const sim = await cctp.simulate({
  from: 'ethereum',
  to: 'arbitrum',
  amount: '100',
});

// {
//   supported: true,
//   version: 'v2-fast',
//   estimatedDuration: '~15 seconds',
//   estimatedFee: { cashmere: '0.12 USDC', circleBurnBps: 1.3 }
// }
This calls the Gas API and Circle Iris to fetch real-time fee data without submitting any transaction.

Framework Integration

Import the JSON tool schemas and pass them directly to the OpenAI API:
import { bridgeToolSchema, simulateToolSchema } from 'cashmere-agent-sdk';

const tools = [
  { type: "function", function: bridgeToolSchema },
  { type: "function", function: simulateToolSchema },
];

const response = await openai.chat.completions.create({
  model: "gpt-4",
  messages: [
    { role: "system", content: "You are a cross-chain treasury agent." },
    { role: "user", content: "Bridge 500 USDC from Ethereum to Solana" },
  ],
  tools,
});

// When the model calls cashmere_bridge or cashmere_simulate,
// parse the arguments and call cctp.transfer() or cctp.simulate()
const call = response.choices[0].message.tool_calls[0];
if (call.function.name === 'cashmere_simulate') {
  const result = await cctp.simulate(JSON.parse(call.function.arguments));
} else if (call.function.name === 'cashmere_bridge') {
  const result = await cctp.transfer(JSON.parse(call.function.arguments));
}
The schema defines two tools:
ToolDescription
cashmere_simulatePreview fee, duration, route — no execution
cashmere_bridgeExecute a cross-chain USDC transfer

Tool Schemas Reference

cashmere_bridge

Executes a cross-chain USDC transfer.
ParameterTypeRequiredDescription
fromstringYesSource chain (e.g. ethereum, arbitrum, solana)
tostringYesDestination chain
amountstringYesUSDC amount, human-readable (e.g. "100")
recipientstringYesDestination wallet address
versionstringNov1, v2-fast, or v2-norm (auto-resolved if omitted)
feeModestringNonative or stable (default: native)
Returns: { txHash, explorerUrl, version, from, to }

cashmere_simulate

Previews a transfer without executing.
ParameterTypeRequiredDescription
fromstringYesSource chain
tostringYesDestination chain
amountstringYesUSDC amount
versionstringNoCCTP version preference
feeModestringNoFee payment mode
Returns: { supported, version, estimatedDuration, estimatedFee: { cashmere, circleBurnBps } }

Supported Chains

ChainDomainV1V2 FastV2 Norm
Ethereum0YYY
Avalanche1YNY
Optimism2YYY
Arbitrum3YYY
Solana5YNY
Base6YYY
Polygon7YNY
Sui8YNN
Aptos9YNN
Unichain10YYY
Linea11NYY
Sonic13NNY
Worldchain14NYY
Monad15NNY
Sei16NNY
HyperEVM19NNY

SKILL.md (Agent Context)

The SDK ships with a SKILL.md file that provides comprehensive context for AI agents. Load it to give your agent detailed knowledge about Cashmere CCTP:
import { readFileSync } from 'fs';

const skillContext = readFileSync(
  require.resolve('cashmere-agent-sdk/SKILL.md'),
  'utf-8',
);

// Pass as system message to your LLM
const messages = [
  { role: "system", content: skillContext },
  { role: "user", content: "What's the fastest way to bridge 1000 USDC to Solana?" },
];
The SKILL.md covers:
  • All contract addresses and program IDs (public, on-chain data)
  • Fee calculation formulas and gas API integration
  • Per-chain transfer patterns and ABI details
  • CCTP version routing rules and estimated durations

Security

Private keys are never logged, stored on disk, or sent to any API other than the chain’s own RPC for transaction submission. The Gas API only receives domain IDs and fee parameters.
  • Keys are provided via environment variables and used only for in-memory signing
  • The SDK contains zero console.log statements
  • All contract addresses in the SDK are public on-chain data
  • The .env.example file ships with empty values — never commit .env

Next Steps