> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tavily research integration

> Integrate with the Tavily research tool using LangChain JavaScript.

[Tavily](https://tavily.com/) is a search engine built specifically for AI agents (LLMs), delivering real-time, accurate, and factual results at speed. Tavily offers a [Research](https://docs.tavily.com/documentation/api-reference/endpoint/research) endpoint that generates comprehensive research reports tailored for LLMs and RAG.

## Overview

### Integration details

| Class                                                                                          | Package                                                                | [PY support](/oss/javascript/integrations/tools/tavily_search) |                                             Downloads                                             |                                             Version                                            |
| :--------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- | :------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------: |
| [`TavilyResearch`](https://reference.langchain.com/javascript/langchain-tavily/TavilyResearch) | [`@langchain/tavily`](https://www.npmjs.com/package/@langchain/tavily) |                                ✅                               | ![NPM - Downloads](https://img.shields.io/npm/dm/@langchain/tavily?style=flat-square\&label=%20&) | ![NPM - Version](https://img.shields.io/npm/v/@langchain/tavily?style=flat-square\&label=%20&) |

### Tool features

| [Returns artifact](/oss/javascript/langchain/tools) | Native async |                 Return data                 |           Pricing          |
| :-------------------------------------------------: | :----------: | :-----------------------------------------: | :------------------------: |
|                          ❌                          |       ✅      | Research report content, sources, citations | 1,000 free credits / month |

## Setup

The integration lives in the `@langchain/tavily` package:

<CodeGroup>
  ```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  npm install @langchain/tavily @langchain/core
  ```

  ```bash yarn theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  yarn add @langchain/tavily @langchain/core
  ```

  ```bash pnpm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  pnpm add @langchain/tavily @langchain/core
  ```
</CodeGroup>

### Credentials

Set up an API key on the [Tavily dashboard](https://app.tavily.com) and set it as an environment variable named `TAVILY_API_KEY`.

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
process.env.TAVILY_API_KEY = "YOUR_API_KEY";
```

It is also helpful (but not needed) to set up [LangSmith](https://smith.langchain.com/?utm_source=docs\&utm_medium=cta\&utm_campaign=langsmith-signup\&utm_content=oss-javascript-integrations-tools-tavily_research) for observability:

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
process.env.LANGSMITH_TRACING = "true";
process.env.LANGSMITH_API_KEY = "your-api-key";
```

## Instantiation

You can import and instantiate `TavilyResearch` like this:

```ts theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { TavilyResearch } from "@langchain/tavily";

const tool = new TavilyResearch({
  // model: "mini",
  // citationFormat: "apa",
  // stream: false,
});
```

* `model` (optional): Research agent model. `"mini"`, `"pro"`, or `"auto"` (default).
* `citationFormat` (optional): Citation format for sources. `"numbered"`, `"mla"`, `"apa"`, or `"chicago"` (default `"numbered"`).
* `outputSchema` (optional): JSON Schema that shapes the research output.
* `stream` (optional): Whether to stream research results. Default is `false`.

## Invocation

### [Invoke directly with args](/oss/javascript/langchain/tools)

The Tavily research tool accepts the following arguments during invocation:

* `input` (required): The research task or question to investigate
* Optional overrides: `model`, `outputSchema`, `stream`, `citationFormat`

```ts theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
await tool.invoke({
  input: "What are the latest developments in AI?",
});
```

### [Invoke with ToolCall](/oss/javascript/langchain/tools)

You can also invoke the tool with a model-generated `ToolCall`, in which case a [`ToolMessage`](https://reference.langchain.com/javascript/langchain-core/messages/ToolMessage) is returned:

```ts theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
// This is usually generated by a model, but we'll create a tool call directly for demo purposes.
const modelGeneratedToolCall = {
  args: {
    input: "What are the latest developments in AI?",
  },
  id: "1",
  name: tool.name,
  type: "tool_call",
};

await tool.invoke(modelGeneratedToolCall);
```

## Use within an agent

Pass the research tool to `createAgent` so the agent can call it with a research task:

```ts theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatOpenAI } from "@langchain/openai";
import { TavilyResearch } from "@langchain/tavily";
import { createAgent } from "langchain";

const llm = new ChatOpenAI({
  model: "gpt-5.5",
});

const tavilyResearchTool = new TavilyResearch({
  model: "mini",
});

const agent = createAgent({
  model: llm,
  tools: [tavilyResearchTool],
});

const userInput =
  "Research the latest developments in AI agents and summarize key trends.";

const stream = await agent.streamEvents(
  { messages: [{ role: "user", content: userInput }] },
  { version: "v3" },
);

await Promise.all([
  (async () => {
    for await (const message of stream.messages) {
      for await (const token of message.text) {
        process.stdout.write(token);
      }
    }
  })(),
  (async () => {
    for await (const call of stream.toolCalls) {
      console.dir({ name: call.name, input: call.input }, { depth: null });
      await call.output;
    }
  })(),
]);

await stream.output;
```

## API reference

For detailed documentation of all Tavily Research API features and configurations, see the API reference: [docs.tavily.com/documentation/api-reference/endpoint/research](https://docs.tavily.com/documentation/api-reference/endpoint/research)

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/tools/tavily_research.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
