Skip to main content

Tavily get research integration

Tavily is a search engine built specifically for AI agents (LLMs), delivering real-time, accurate, and factual results at speed. Tavily offers a Get Research endpoint that retrieves previously created research reports by request ID.

Use this tool after TavilyResearch to poll for status and fetch completed results.

Overview

Integration details

ClassPackagePY supportDownloadsVersion
TavilyGetResearch@langchain/tavily✅NPM - DownloadsNPM - Version

Tool features

Returns artifactNative asyncReturn dataPricing
❌✅Research status, report content, sources1,000 free credits / month

Setup

The integration lives in the @langchain/tavily package:

npmyarnpnpm

npm install @langchain/tavily @langchain/core

Credentials

Set up an API key on the Tavily dashboard and set it as an environment variable named TAVILY_API_KEY.

process.env.TAVILY_API_KEY = "YOUR_API_KEY";

It is also helpful (but not needed) to set up LangSmith for observability:

process.env.LANGSMITH_TRACING = "true";
process.env.LANGSMITH_API_KEY = "your-api-key";

Instantiation

You can import and instantiate TavilyGetResearch like this:

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

const tool = new TavilyGetResearch();

Invocation

Invoke directly with args

The Tavily get research tool accepts the following argument during invocation:

  • requestId (required): The unique identifier of the research task to retrieve
await tool.invoke({
  requestId: "your-request-id-here",
});

Invoke with ToolCall

You can also invoke the tool with a model-generated ToolCall, in which case a ToolMessage is returned:

// This is usually generated by a model, but we'll create a tool call directly for demo purposes.
const modelGeneratedToolCall = {
  args: {
    requestId: "your-request-id-here",
  },
  id: "1",
  name: tool.name,
  type: "tool_call",
};

await tool.invoke(modelGeneratedToolCall);

Use within an agent

Pass both research tools to createAgent so the agent can start a research task and retrieve results by request ID:

import { ChatOpenAI } from "@langchain/openai";
import { TavilyGetResearch, TavilyResearch } from "@langchain/tavily";
import { createAgent } from "langchain";

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

const agent = createAgent({
  model: llm,
  tools: [
    new TavilyResearch({
      model: "mini",
    }),
    new TavilyGetResearch(),
  ],
});

const userInput =
  "Start a research task on AI agents, then retrieve the results when ready.";

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 Get Research API features and configurations, see the API reference: docs.tavily.com/documentation/api-reference/endpoint/research-get