Skip to main content
Tavily is a search engine built specifically for AI agents (LLMs), delivering real-time, accurate, and factual results at speed. Tavily offers an Extract endpoint that can be used to extract content from one or more URLs.

Overview

Integration details

Tool features

Setup

The integration lives in the langchain-tavily package.

Credentials

We also need to set our Tavily API key. You can get an API key by visiting this site and creating an account.

Instantiation

The tool accepts various parameters during instantiation:
  • extract_depth (optional, str): The depth of the extraction, either “basic” or “advanced”. Default is “basic ”.
  • include_images (optional, bool): Whether to include images in the extraction. Default is False.
For a comprehensive overview of the available parameters, refer to the Tavily Extract API documentation

Invocation

Invoke directly with args

The Tavily extract tool accepts the following arguments during invocation:
  • urls (required): A list of URLs to extract content from.
  • Both extract_depth and include_images can also be set during invocation
NOTE: The optional arguments are available for agents to dynamically set, if you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation.

Invoke with ToolCall

We can also invoke the tool with a model-generated ToolCall, in which case a ToolMessage will be returned:

Use within an agent

We can use our tools directly with an agent executor by binding the tool to the agent. This gives the agent the ability to dynamically set the available arguments to the Tavily search tool.

API reference

For detailed documentation of all Tavily Extract API features and configurations head to the API reference: docs.tavily.com/documentation/api-reference/endpoint/extract