AgentForge with the Vercel AI SDK

DeFi safety tools for AI SDK agents, paid per call in USDC over x402. No API key or account.

Install

npm install agentforge-tools ai

Use

import { generateText, isStepCount } from 'ai';
import { agentForgeAiSdkTools } from 'agentforge-tools/ai-sdk';

const { text } = await generateText({
  model: 'anthropic/claude-haiku-5.5',
  tools: agentForgeAiSdkTools({
    privateKey: process.env.AGENTFORGE_PRIVATE_KEY as `0x${string}`, // Base wallet holding USDC
    maxPaymentUsd: 0.1, // refuse any single payment above $0.10
  }),
  stopWhen: isStepCount(5),
  prompt: 'Is 0x71927529167fde40ebd4d2acdabfc88afd340f35 close to liquidation on Aave?',
});

console.log(text);

agentForgeAiSdkTools() returns every tool below as an AI SDK tool() with a JSON Schema input, keyed by name. Pass a subset if you only want some: const { agentforge_simulate_transaction } = agentForgeAiSdkTools(opts).

How payment works

Each tool calls an AgentForge HTTPS endpoint. The endpoint answers with HTTP 402 and its exact price; the package signs a USDC payment authorization from your wallet (gasless, x402 exact scheme on Base) and retries. Any single payment above maxPaymentUsd is refused before anything is signed, and calls that fail (4xx/5xx) are never charged. The wallet only needs USDC on Base — no ETH for gas.

Already have an x402-paying fetch (for example a Coinbase CDP wallet)? Pass it instead of a key: agentForgeAiSdkTools({ fetch: myPayingFetch }).

Tools

ToolWhat it doesPrice
agentforge_simulate_transactionSimulate 1-5 EVM transactions before signing: revert reasons, assets leaving or entering the wallet, approvals granted, counterparty sanctions/scam screening, proceed/caution/avoid$0.005
agentforge_check_addressesScreen 1-100 EVM or Solana addresses against OFAC sanctions, scam wallets, and fresh address-poisoning wallets$0.003 + $0.001/extra
agentforge_trade_checkRug-check metrics, AI risk assessment, and gas for a token, with a verdict$0.025
agentforge_new_launchesNewly launched tokens on Base, Ethereum, or Arbitrum, already risk-scored; poll with since$0.005
agentforge_score_tokensRisk scores for 2-25 tokens in one call$0.004/token
agentforge_lending_healthAave v3 liquidation risk on nine chains$0.003
agentforge_approval_scanRisky ERC-20 approvals held on a wallet$0.015
agentforge_decode_transactionPlain-English decode of an EVM transaction$0.05

No wallet yet?

Every tool is also available free (up to a daily cap) over MCP at https://agentforge-taupe.vercel.app/mcp, which the AI SDK can consume with its MCP client.

Links

npm · GitHub · Catalog · OpenAPI · llms.txt