{"id":2303,"library":"tavily-python","title":"Tavily Python SDK","description":"The `tavily-python` library provides a Python wrapper for the Tavily API, enabling easy integration of web search, content extraction, crawling, mapping, and research functionalities into Python applications. It supports both synchronous and asynchronous clients. The library is under active development with frequent updates, with its current version being 0.7.23.","status":"active","version":"0.7.23","language":"en","source_language":"en","source_url":"https://github.com/tavily-ai/tavily-python","tags":["AI","API Client","Search","Web Scraping","RAG","LLM Tools","Information Retrieval"],"install":[{"cmd":"pip install tavily-python","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Used for HTTP requests in the synchronous client.","package":"requests","optional":false},{"reason":"Used for tokenization, likely for cost estimation or context management.","package":"tiktoken","optional":false},{"reason":"Used for HTTP requests in the asynchronous client.","package":"httpx","optional":false}],"imports":[{"note":"Use this for synchronous API calls.","symbol":"TavilyClient","correct":"from tavily import TavilyClient"},{"note":"Use this for asynchronous API calls.","symbol":"AsyncTavilyClient","correct":"from tavily import AsyncTavilyClient"},{"note":"Import for handling specific API key related exceptions.","symbol":"MissingAPIKeyError","correct":"from tavily import MissingAPIKeyError"}],"quickstart":{"code":"import os\nfrom tavily import TavilyClient\n\ntavily_client = TavilyClient(api_key=os.environ.get('TAVILY_API_KEY', ''))\n\nif not tavily_client.api_key:\n    raise ValueError(\"TAVILY_API_KEY environment variable not set. Get your key from tavily.com.\")\n\nresponse = tavily_client.search(\"What is the capital of France?\")\nprint(response)","lang":"python","description":"This quickstart initializes the TavilyClient with an API key from an environment variable and performs a basic search query. It includes a check to ensure the API key is provided, which is crucial for successful API calls."},"warnings":[{"fix":"Migrate to `langchain-tavily` by installing `pip install -U langchain-tavily` and updating your LangChain integrations.","message":"The `langchain_community.tools.tavily_search.tool` has been deprecated in favor of the new `langchain-tavily` Python package. This new package supports Search, Extract, Map, and Crawl functionality and receives continuous updates.","severity":"deprecated","affected_versions":"All versions when using `langchain_community.tools`"},{"fix":"Ensure `api_key` is passed to `TavilyClient` or `AsyncTavilyClient` constructor, preferably via an environment variable (e.g., `TAVILY_API_KEY`).","message":"Failure to provide a valid Tavily API key during client instantiation will result in a `tavily.MissingAPIKeyError`. The API key is essential for all API interactions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Regenerate your API key on the Tavily platform dashboard and retry. Check the Tavily status page or community for service announcements.","message":"Intermittent HTTP 400 Client Errors or 500 Server Errors have been reported by users, often related to API outages or invalid/expired API keys.","severity":"gotcha","affected_versions":"All versions (API service-dependent)"},{"fix":"To avoid unexpected costs, explicitly set `search_depth='basic'` or monitor credit usage when `auto_parameters` is enabled.","message":"Using `auto_parameters=True` in the `search` method might automatically set `search_depth` to `advanced`, which can consume more API credits (2 API credits instead of 1 for `basic`).","severity":"gotcha","affected_versions":"Versions with `auto_parameters` feature (from ~July 2025 onwards)"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}