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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ainative/ai-kit-tools

v0.1.0-alpha.2

Published

AI Kit - Built-in tools for agents including web search, calculator, code interpreter, and more

Downloads

21

Readme

@ainative/ai-kit-tools

Production-ready tools for AI Kit agents.

Overview

This package provides a collection of built-in tools that AI agents can use to perform various tasks. Each tool is designed to be:

  • Type-safe: Full TypeScript support with Zod schemas
  • Well-tested: 80%+ test coverage
  • Production-ready: Comprehensive error handling and rate limiting
  • Agent-compatible: Works seamlessly with the AI Kit agent framework

Available Tools

Web Search Tool

Search the web using Brave Search API with structured results.

import { createWebSearchTool } from '@ainative/ai-kit-tools';

const webSearchTool = createWebSearchTool({
  provider: 'brave',
  apiKey: process.env.BRAVE_API_KEY!,
  maxResults: 10,
});

const result = await webSearchTool.execute({
  query: 'latest AI developments 2025',
  maxResults: 5,
});

Features:

  • Multiple search provider support (Brave, Google, Bing)
  • Built-in rate limiting (token bucket algorithm)
  • Structured results with title, URL, snippet, and metadata
  • Comprehensive error handling
  • Configurable timeouts and retry logic

Documentation: Web Search Usage Guide

Story Points: 8

Calculator Tool

Safe mathematical expression evaluation with support for statistics.

import { calculator } from '@ainative/ai-kit-tools';

const result = calculator.execute({
  expression: '(10 + 5) * 2',
});

Features:

  • Safe expression evaluation (no eval)
  • Statistical operations (mean, median, mode, etc.)
  • Equation solving
  • Batch calculations
  • Input validation

Story Points: 5

Code Interpreter Tool

Execute code in a sandboxed environment with multiple language support.

import { codeInterpreterTool } from '@ainative/ai-kit-tools';

const result = await codeInterpreterTool.execute({
  language: 'javascript',
  code: 'console.log("Hello, World!")',
});

Features:

  • JavaScript execution
  • Python support (coming soon)
  • Sandboxed environment
  • Timeout protection
  • Memory limits
  • Output capture

Story Points: 13

ZeroDB Query Tool

Query and manage ZeroDB resources with natural language.

import { createZeroDBQueryTool } from '@ainative/ai-kit-tools';

const zerodbTool = createZeroDBQueryTool({
  apiKey: process.env.ZERODB_API_KEY!,
  projectId: 'my-project',
});

Features:

  • Natural language query parsing
  • Vector search support
  • Table operations
  • Event stream access
  • Result formatting

Story Points: 13

Installation

npm install @ainative/ai-kit-tools
# or
pnpm add @ainative/ai-kit-tools
# or
yarn add @ainative/ai-kit-tools

Usage with Agents

import { Agent } from '@ainative/ai-kit-core';
import {
  createWebSearchTool,
  calculator,
  codeInterpreterTool,
} from '@ainative/ai-kit-tools';

const agent = new Agent({
  id: 'research-agent',
  name: 'Research Agent',
  systemPrompt: 'You are a research assistant with web search and calculation capabilities.',
  llm: {
    provider: 'anthropic',
    model: 'claude-3-5-sonnet-20241022',
    apiKey: process.env.ANTHROPIC_API_KEY!,
  },
  tools: [
    createWebSearchTool({
      provider: 'brave',
      apiKey: process.env.BRAVE_API_KEY!,
    }),
    calculator,
    codeInterpreterTool,
  ],
});

const response = await agent.execute('Find the latest AI news and calculate market growth');

API Reference

Tool Definition Interface

All tools follow the standard ToolDefinition interface from @ainative/ai-kit-core:

interface ToolDefinition<TParams = any, TResult = any> {
  name: string;
  description: string;
  parameters: z.ZodObject<any> | z.ZodType<any>;
  execute: (params: TParams) => Promise<TResult>;
  retry?: {
    maxAttempts: number;
    backoffMs: number;
  };
  timeoutMs?: number;
  metadata?: Record<string, unknown>;
}

Environment Variables

Required

Optional

  • ZERODB_API_KEY - For ZeroDB query tool
  • ZERODB_PROJECT_ID - Your ZeroDB project ID

Testing

Each tool comes with comprehensive test coverage:

# Run all tests
pnpm test

# Run tests with coverage
pnpm test:coverage

# Run specific tool tests
pnpm test web-search
pnpm test calculator

Development

Building

pnpm build

Type Checking

pnpm type-check

Linting

pnpm lint

Contributing

When adding a new tool:

  1. Create the tool implementation in src/
  2. Add comprehensive tests in __tests__/
  3. Ensure 80%+ test coverage
  4. Update exports in src/index.ts
  5. Create usage documentation in docs/
  6. Update this README

Error Handling

All tools provide specific error classes for better error handling:

import {
  WebSearchError,
  RateLimitError,
  InvalidAPIKeyError,
} from '@ainative/ai-kit-tools';

try {
  await webSearchTool.execute({ query: 'test' });
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log('Rate limited. Retry after:', error.resetAt);
  } else if (error instanceof InvalidAPIKeyError) {
    console.log('Invalid API key');
  } else if (error instanceof WebSearchError) {
    console.log('Search error:', error.message);
  }
}

Performance

All tools are optimized for production use:

  • Rate Limiting: Built-in rate limiting prevents API quota exhaustion
  • Timeouts: Configurable timeouts prevent hanging requests
  • Retries: Automatic retry with exponential backoff for transient failures
  • Caching: Response caching where appropriate

License

MIT

Support