Integrations

AI SDK tools

tollexTools() returns AI SDK 7 tools; tollexToolApproval makes the buying tool ask the user first.

import { generateText, stepCountIs } from "ai";
import { tollexTools, tollexToolApproval } from "@tollex/ai-sdk";

const res = await generateText({
  model,
  tools: tollexTools({ client, tools: new TollexTools(client, TOLLEX_URL) }),
  toolApproval: tollexToolApproval,
  stopWhen: stepCountIs(5),
  prompt: "Get the ETH-USD spot price for under 0.005 USDG.",
});

Tools: tollexResolve, tollexDo, tollexOperation, tollexVerifyReceipt, tollexDiscover. Results are objects with ok and either data or error, so the model reads the reason instead of an exception. With the approval map, the SDK stops before tollexDo and nothing is signed until the user approves.

The packages are not on public registries yet. During onboarding you receive tarballs and a wheel; install them from the files, for example npm install ./tollex-client-0.2.0.tgz.