npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@agentek/ai-sdk

v0.1.19

Published

AI SDK integration for Agentek tools

Downloads

51

Readme

Agentek AI SDK

A toolkit for integrating Agentek blockchain tools with the Vercel AI SDK. This package provides adapters that make Agentek's blockchain tools available as AI function calling tools.

✨ Features

  • Vercel AI SDK Integration: Seamless integration with Vercel's AI SDK
  • Tool Conversion: Automatically converts Agentek tools to AI SDK compatible format
  • Unified Toolkit: Bundle multiple tools into a single toolkit
  • Type Safety: Full TypeScript support with strict typing
  • Compatibility: Works with OpenRouter, Anthropic, OpenAI, and other LLM providers

🚀 Installation

# npm
npm install @agentek/ai-sdk @agentek/tools

# pnpm
pnpm add @agentek/ai-sdk @agentek/tools

# yarn
yarn add @agentek/ai-sdk @agentek/tools

📋 Requirements

  • Node.js >= 18.17.0 (Required for proper fetch API support)
  • @agentek/tools as a peer dependency
  • Vercel's ai package

🔧 Usage

Basic Usage with AI SDK and OpenRouter

import { http } from "viem";
import { mainnet } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
import { CoreMessage, generateText } from "ai";
import AgentekToolkit from "@agentek/ai-sdk/toolkit";
import { erc20Tools } from "@agentek/tools/erc20";
import { ensTools } from "@agentek/tools/ens";

// Set up account
const account = privateKeyToAccount(process.env.PRIVATE_KEY);

// Initialize OpenRouter
const openrouter = createOpenRouter({
  apiKey: process.env.OPENROUTER_API_KEY,
});

// Create the toolkit with your tools
const toolkit = new AgentekToolkit({
  transports: [http()],
  chains: [mainnet],
  accountOrAddress: account,
  tools: [
    ...erc20Tools(),
    ...ensTools(),
    // Add more tools as needed
  ],
});

// Get tools in AI SDK format
const tools = toolkit.getTools();

// Set up user query
const messages = [
  {
    role: "user",
    content: "What's the ETH balance of vitalik.eth?",
  },
] as CoreMessage[];

// Generate response with AI using tools
const response = await generateText({
  model: openrouter("anthropic/claude-3-opus"),
  system: `Address: ${account.address}`,
  messages,
  maxSteps: 5, // Maximum number of tool calls
  tools: tools,
  experimental_activeTools: Object.keys(tools),
});

// Process response
console.log(response.response.messages);

Creating a Toolkit with Various Tool Categories

import { http } from "viem";
import { mainnet, base } from "viem/chains";
import AgentekToolkit from "@agentek/ai-sdk/toolkit";
import { erc20Tools } from "@agentek/tools/erc20";
import { webTools } from "@agentek/tools/web";
import { naniTools } from "@agentek/tools/nani";
import { fearGreedIndexTools } from "@agentek/tools/feargreed";

// Create toolkit with multiple transports for different chains
const toolkit = new AgentekToolkit({
  transports: [http(), http()],
  chains: [mainnet, base],
  accountOrAddress: account,
  tools: [
    ...erc20Tools(),
    ...webTools(),
    ...naniTools(),
    ...fearGreedIndexTools(),
    // Add API key dependent tools conditionally
    ...(process.env.ZEROX_API_KEY ? swapTools({ zeroxApiKey: process.env.ZEROX_API_KEY }) : []),
  ],
});

🏗️ Implementation Notes

  • The toolkit automatically converts Zod parameter schemas into AI SDK tool definitions
  • Error handling is built-in with descriptive error messages
  • Each tool uses the Agentek client for blockchain interaction

📚 Documentation

For more detailed documentation and examples, see the examples directory in the repository.

📄 License

AGPL-3.0