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

@langchain/tavily

v1.2.0

Published

Tavily integration for LangChain.js

Readme

@langchain/tavily

NPM - Version

This package provides integrations for the Tavily search engine within LangChain.js. Tavily is a search engine built specifically for AI agents (LLMs), delivering real-time, accurate, and factual results at speed.

This package exposes four tools:

  • TavilySearch: Performs a search optimized for LLMs and RAG.
  • TavilyExtract: Extracts raw content from a list of URLs.
  • TavilyCrawl: Initiates a structured web crawl starting from a specified base URL.
  • TavilyMap: Generates a site map starting from a specified base URL.
  • TavilyResearch: Creates structured research tasks and optionally streams research output.
  • TavilyGetResearch: Retrieves research results by request_id for previously created research tasks.

Installation

npm install @langchain/tavily

Setup

You need a Tavily API key to use these tools. You can get one here. Set it as an environment variable:

process.env.TAVILY_API_KEY = "YOUR_API_KEY";

Usage

TavilySearch

import { TavilySearch } from "@langchain/tavily";

const tool = new TavilySearch({
  maxResults: 5,
  // You can set other constructor parameters here, e.g.:
  // topic: "general",
  // includeAnswer: false,
  // includeRawContent: false,
  // includeImages: false,
  // searchDepth: "basic",
});

// Invoke with a query
const results = await tool.invoke({
  query: "what is the current weather in SF?",
});

console.log(results);

TavilyExtract

import { TavilyExtract } from "@langchain/tavily";

const tool = new TavilyExtract({
  // Constructor parameters:
  // extractDepth: "basic",
  // includeImages: false,
});

// Invoke with a list of URLs
const results = await tool.invoke({
  urls: ["https://en.wikipedia.org/wiki/Lionel_Messi"],
});

console.log(results);

TavilyResearch

import { TavilyResearch } from "@langchain/tavily";

const tool = new TavilyResearch({
  // Optional constructor defaults:
  // model: "auto",
  // stream: false,
  // citationFormat: "numbered",
  // apiBaseUrl: "https://api.tavily.com",
});

// Invoke with a research task
const result = await tool.invoke({
  input: "Research the latest developments in AI",
  model: "mini",
  citationFormat: "apa",
});

console.log(result);

TavilyGetResearch

import { TavilyGetResearch } from "@langchain/tavily";

const tool = new TavilyGetResearch({
  // Optional constructor parameters:
  // apiBaseUrl: "https://api.tavily.com",
});

// Invoke with a request_id returned from TavilyResearch
const result = await tool.invoke({
  requestId: "your-request-id-here",
});

console.log(result);

TavilyCrawl

import { TavilyCrawl } from "@langchain/tavily";

const tool = new TavilyCrawl({
  // Constructor parameters:
  // extractDepth: "basic",
  // format: "markdown",
  // maxDepth: 3,
  // maxBreadth: 50,
  // limit: 100,
  // includeImages: false,
  // allowExternal: false,
});

// Invoke with a URL and optional parameters
const results = await tool.invoke({
  url: "https://docs.tavily.com/",
  instructions: "Find information about the LangChain integration.",
});

console.log(results);

TavilyMap

import { TavilyMap } from "@langchain/tavily";

const tool = new TavilyMap({
  // Constructor parameters:
  // maxDepth: 3,
  // maxBreadth: 50,
  // limit: 100,
  // allowExternal: false,
});

// Invoke with a URL and optional parameters
const results = await tool.invoke({
  url: "https://docs.tavily.com/",
});

console.log(results);

Documentation

For more detailed information, check out the documentation pages:

License

This package is licensed under the MIT License. See the LICENSE file for details.