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

@tavily/ai-sdk

v0.1.1

Published

Tavily AI SDK tools - Search, Extract, Crawl, and Map

Readme

@tavily/ai-sdk

AI SDK tools for Tavily, built for Vercel's AI SDK v5.

Features

  • Search: Real-time web search optimized for AI applications
  • Extract: Clean, structured content extraction from URLs
  • Crawl: Intelligent website crawling at scale
  • Map: Website structure discovery and mapping

Installation

npm install @tavily/ai-sdk
# or
pnpm install @tavily/ai-sdk
# or
yarn add @tavily/ai-sdk

Prerequisites

You need a Tavily API key to use these tools. Get one at tavily.com.

Set your API key as an environment variable:

export TAVILY_API_KEY=tvly-your-api-key

Or pass it directly to the tool configuration.

Usage

Tavily Search

Search the web for real-time, AI-optimized information:

import { tavilySearch } from "@tavily/ai-sdk";
import { generateText, gateway, stepCountIs } from "ai";

const result = await generateText({
  model: gateway("openai/gpt-5-mini"),
  prompt: "What are the latest developments in quantum computing?",
  tools: {
    tavilySearch: tavilySearch({
      searchDepth: "advanced",
      includeAnswer: true,
      maxResults: 5,
    }),
  },
  stopWhen: stepCountIs(3),
});

Configuration Options:

  • apiKey?: string - Tavily API key (defaults to TAVILY_API_KEY env var)
  • searchDepth?: "basic" | "advanced" - Search depth (default: "basic")
  • topic?: "general" | "news" | "finance" - Search category (default: "general")
  • includeImages?: boolean - Include images in results (default: false)
  • includeAnswer?: boolean - Include AI-generated answer (default: false)
  • maxResults?: number - Maximum results to return (default: 5)
  • includeImageDescriptions?: boolean - Include AI-generated image descriptions
  • includeRawContent?: false | "markdown" | "text" - Include raw content in specified format
  • includeDomains?: string[] - List of domains to include in search
  • excludeDomains?: string[] - List of domains to exclude from search
  • maxTokens?: number - Maximum number of tokens in response
  • timeRange?: "year" | "month" | "week" | "day" | "y" | "m" | "w" | "d" - Time range for results
  • chunksPerSource?: number - Number of content chunks per source
  • country?: string - Country code for localized results
  • startDate?: string - Start date for results (YYYY-MM-DD format)
  • endDate?: string - End date for results (YYYY-MM-DD format)
  • days?: number - Number of days back to search (for news/finance topics)
  • autoParameters?: boolean - Enable automatic parameter optimization
  • timeout?: number - Request timeout in milliseconds
  • includeFavicon?: boolean - Include favicon URLs in results
  • proxies?: { http?: string, https?: string } - HTTP/HTTPS proxy configuration
  • apiBaseURL?: string - Custom API base URL

Tavily Extract

Extract clean, structured content from URLs:

import { tavilyExtract } from "@tavily/ai-sdk";
import { generateText, gateway, stepCountIs } from "ai";

const result = await generateText({
  model: gateway("openai/gpt-5-mini"),
  prompt: "Extract and summarize the content from https://tavily.com",
  tools: {
    tavilyExtract: tavilyExtract(),
  },
  stopWhen: stepCountIs(3),
});

Configuration Options:

  • apiKey?: string - Tavily API key (defaults to TAVILY_API_KEY env var)
  • includeImages?: boolean - Include images in extracted content (default: false)
  • extractDepth?: "basic" | "advanced" - Extraction depth (default: "basic")
  • format?: "markdown" | "text" - Output format (default: "markdown")
  • timeout?: number - Request timeout in milliseconds
  • includeFavicon?: boolean - Include favicon URLs in results
  • proxies?: { http?: string, https?: string } - HTTP/HTTPS proxy configuration
  • apiBaseURL?: string - Custom API base URL

Input Parameters (for AI agent):

  • urls: string[] - Array of URLs to extract content from (required)
  • extractDepth?: "basic" | "advanced" - Override extraction depth per call

Tavily Crawl

Crawl websites to discover and extract content from multiple pages:

import { tavilyCrawl } from "@tavily/ai-sdk";
import { generateText, gateway, stepCountIs } from "ai";

const result = await generateText({
  model: gateway("openai/gpt-5-mini"),
  prompt: "Crawl tavily.com and tell me about their integrations",
  tools: {
    tavilyCrawl: tavilyCrawl(),
  },
  stopWhen: stepCountIs(3),
});

Configuration Options:

  • apiKey?: string - Tavily API key (defaults to TAVILY_API_KEY env var)
  • maxDepth?: number - Maximum crawl depth (1-5, default: 1)
  • maxBreadth?: number - Maximum pages per depth level (1-100, default: 20)
  • limit?: number - Maximum total pages to crawl (default: 50)
  • extractDepth?: "basic" | "advanced" - Content extraction depth
  • instructions?: string - Natural language crawling instructions
  • selectPaths?: string[] - Path patterns to include (e.g., ["/blog/*"])
  • selectDomains?: string[] - Domains to include
  • excludePaths?: string[] - Path patterns to exclude (e.g., ["/admin/*"])
  • excludeDomains?: string[] - Domains to exclude
  • allowExternal?: boolean - Allow crawling external domains (default: false)
  • includeImages?: boolean - Include images in extracted content
  • format?: "markdown" | "text" - Output format (default: "markdown")
  • timeout?: number - Request timeout in milliseconds
  • includeFavicon?: boolean - Include favicon URLs in results
  • proxies?: { http?: string, https?: string } - HTTP/HTTPS proxy configuration
  • apiBaseURL?: string - Custom API base URL

Input Parameters (for AI agent):

  • url: string - Base URL to start crawling from (required)
  • maxDepth?: number - Override maximum crawl depth per call
  • extractDepth?: "basic" | "advanced" - Override extraction depth per call
  • instructions?: string - Override or specify crawling instructions per call
  • allowExternal?: boolean - Override external domain crawling setting per call

Tavily Map

Map website structure to understand site architecture:

import { tavilyMap } from "@tavily/ai-sdk";
import { generateText, gateway, stepCountIs } from "ai";

const result = await generateText({
  model: gateway("openai/gpt-5-mini"),
  prompt: "Map the structure of tavily.com",
  tools: {
    tavilyMap: tavilyMap(),
  },
  stopWhen: stepCountIs(3),
});

Configuration Options:

  • apiKey?: string - Tavily API key (defaults to TAVILY_API_KEY env var)
  • maxDepth?: number - Maximum mapping depth (1-5, default: 1)
  • maxBreadth?: number - Maximum pages per depth level (1-100, default: 20)
  • limit?: number - Maximum total pages to map (default: 50)
  • instructions?: string - Natural language mapping instructions
  • selectPaths?: string[] - Path patterns to include (e.g., ["/docs/*"])
  • selectDomains?: string[] - Domains to include
  • excludePaths?: string[] - Path patterns to exclude (e.g., ["/api/*"])
  • excludeDomains?: string[] - Domains to exclude
  • allowExternal?: boolean - Allow mapping external domains (default: false)
  • timeout?: number - Request timeout in milliseconds
  • proxies?: { http?: string, https?: string } - HTTP/HTTPS proxy configuration
  • apiBaseURL?: string - Custom API base URL

Input Parameters (for AI agent):

  • url: string - Base URL to start mapping from (required)
  • maxDepth?: number - Override maximum mapping depth per call
  • instructions?: string - Override or specify mapping instructions per call
  • allowExternal?: boolean - Override external domain mapping setting per call

Using Multiple Tools Together

You can combine multiple Tavily tools in a single AI agent:

import { 
  tavilySearch, 
  tavilyExtract, 
  tavilyCrawl, 
  tavilyMap 
} from "@tavily/ai-sdk";
import { generateText, gateway, stepCountIs } from "ai";

const result = await generateText({
  model: gateway("openai/gpt-5-mini"),
  prompt: "Research the company at tavily.com - search for news, map their site, and extract key pages",
  tools: {
    tavilySearch: tavilySearch({ searchDepth: "advanced" }),
    tavilyExtract: tavilyExtract(),
    tavilyCrawl: tavilyCrawl(),
    tavilyMap: tavilyMap(),
  },
  stopWhen: stepCountIs(3),
});

Development

Setup

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Create a .env file:
TAVILY_API_KEY=tvly-your-api-key

API Reference

For detailed API documentation, visit docs.tavily.com.

License

MIT

Support