Adapters
TanStack AI
Using wallet tools with TanStack AI.
Tool Execution Issues
TanStack AI currently has known issues with executing tool calls. The AI may fail to properly invoke tools or return inconsistent results. For production use cases requiring reliable tool execution, we recommend using the Vercel AI SDK adapter instead.
Minimal Setup
import { chat } from '@tanstack/ai';
import { openRouterText } from '@tanstack/ai-openrouter';
import { toTanstackTools } from '@agentic-wallet/adapters-tanstack';
const tools = toTanstackTools(wallet);
const result = await chat({
message: 'Swap 0.1 SOL for USDC',
adapter: openRouterText('google/gemini-2.5-pro'),
tools,
});Full Example
import { chat } from '@tanstack/ai';
import { openRouterText } from '@tanstack/ai-openrouter';
import { toTanstackTools } from '@agentic-wallet/adapters-tanstack';
import { SolanaAgentWallet, createKeypairProvider } from '@agentic-wallet/solana';
import { pumpfunPlugin, jupiterPlugin } from '@agentic-wallet/solana/plugin';
const wallet = new SolanaAgentWallet({
provider: createKeypairProvider(process.env.PRIVATE_KEY!),
rpcUrl: process.env.RPC_URL!,
}).use(pumpfunPlugin()).use(jupiterPlugin());
const stream = chat({
message: 'What is my SOL balance?',
adapter: openRouterText('google/gemini-2.5-pro'),
tools: toTanstackTools(wallet),
});
for await (const chunk of stream) {
console.log(chunk);
}API
toTanstackTools(wallet) // returns ServerTool[]Pass the result to chat() or generateText() as the tools option.
Related
- Vercel AI SDK Adapter - Recommended for production use