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.
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:
Tool
Description
cashmere_simulate
Preview fee, duration, route — no execution
cashmere_bridge
Execute a cross-chain USDC transfer
The SDK provides ready-made LangChain Tool classes:
import { CashmereCCTP } from 'cashmere-agent-sdk';import { CashmereBridgeTool, CashmereSimulateTool,} from 'cashmere-agent-sdk/tools/langchain';const cctp = new CashmereCCTP({ evm: { privateKey: process.env.EVM_PRIVATE_KEY },});const tools = [ new CashmereBridgeTool(cctp), new CashmereSimulateTool(cctp),];// Use with any LangChain agentimport { createReactAgent } from '@langchain/langgraph/prebuilt';const agent = createReactAgent({ llm: chatModel, tools });const result = await agent.invoke({ messages: [{ role: "user", content: "Send 200 USDC from Base to Polygon" }],});
Both tools accept JSON string input and return JSON string output, compatible with all LangChain agent types.
crewAI uses LangChain tools natively. The same CashmereBridgeTool and CashmereSimulateTool classes work directly:
# crewAI uses LangChain tools under the hood# In your Python crewAI setup, wrap the Node.js SDK via subprocess or HTTP# Or use the JSON tool schemas for a Python-native approach:cashmere_tool = { "name": "cashmere_bridge", "description": "Bridge USDC across chains via Cashmere CCTP...", "parameters": { "type": "object", "properties": { "from": {"type": "string", "description": "Source chain"}, "to": {"type": "string", "description": "Destination chain"}, "amount": {"type": "string", "description": "USDC amount"}, "recipient": {"type": "string", "description": "Destination address"}, }, "required": ["from", "to", "amount", "recipient"], },}
For TypeScript crewAI setups, use the LangChain tools directly as shown in the LangChain tab.
For any framework that supports function calling, use the raw JSON schemas:
import { bridgeToolSchema, simulateToolSchema } from 'cashmere-agent-sdk';// bridgeToolSchema and simulateToolSchema are plain objects:// {// name: "cashmere_bridge",// description: "...",// parameters: { type: "object", properties: {...}, required: [...] }// }// Register as tools in your framework, then dispatch:async function handleToolCall(name: string, args: any) { if (name === 'cashmere_bridge') { return await cctp.transfer(args); } else if (name === 'cashmere_simulate') { return await cctp.simulate(args); }}
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 LLMconst 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
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