{"record":{"id":"cd9ef44c20a74c67","repo":"crewAIInc/crewAI","slug":"the-tavily-python-package-is-required-to-use-the","errorCode":null,"errorMessage":"The 'tavily-python' package is required to use the TavilyExtractorTool. Please install it with: uv add tavily-python","messagePattern":"The 'tavily-python' package is required to use the TavilyExtractorTool\\. Please install it with: uv add tavily-python","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py","lineNumber":121,"sourceCode":"                    \"The 'tavily-python' package is required. 'click' and 'subprocess' are also needed to assist with installation if the package is missing. \"\n                    \"Please install 'tavily-python' manually (e.g., 'uv add tavily-python') and ensure 'click' and 'subprocess' are available.\"\n                ) from None\n\n            if click.confirm(\n                \"You are missing the 'tavily-python' package, which is required for TavilyExtractorTool. Would you like to install it?\"\n            ):\n                try:\n                    subprocess.run([\"uv pip\", \"install\", \"tavily-python\"], check=True)  # noqa: S607\n                    raise ImportError(\n                        \"'tavily-python' has been installed. Please restart your Python application to use the TavilyExtractorTool.\"\n                    )\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\n                        f\"Attempted to install 'tavily-python' but failed: {e}. \"\n                        f\"Please install it manually to use the TavilyExtractorTool.\"\n                    ) from e\n            else:\n                raise ImportError(\n                    \"The 'tavily-python' package is required to use the TavilyExtractorTool. \"\n                    \"Please install it with: uv add tavily-python\"\n                )\n\n    def _run(\n        self,\n        urls: list[str] | str,\n    ) -> str:\n        \"\"\"Synchronously extracts content from the given URL(s).\n\n        Args:\n            urls: The URL(s) to extract data from.\n\n        Returns:\n            A JSON string containing the extracted data.\n        \"\"\"\n        if not self.client:\n            raise ValueError(","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_extractor_tool/tavily_extractor_tool.py#L103-L139","documentation":"TavilyExtractorTool raises this ImportError when the interactive click.confirm prompt asks to install tavily-python and the user declines (answers 'n'). It is the explicit 'user refused the fix' branch; the tool refuses to construct without its required client library.","triggerScenarios":"TavilyExtractorTool.__init__ with tavily-python missing and the operator answering 'no' to the confirmation prompt (or a non-TTY/automated harness whose stdin yields a falsy answer).","commonSituations":"Interactive sessions where the user is unsure about adding dependencies; scripts run with stdin closed so click.confirm defaults to aborting/declining.","solutions":["Install the package and retry: uv add tavily-python (or pip install tavily-python).","If running non-interactively, pre-install tavily-python so the prompt never appears.","Set TAVILY_API_KEY and add tavily-python to your project dependencies to make first-run deterministic."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec(\"tavily\") is None:\n    raise SystemExit(\"tavily-python required. Install with: uv add tavily-python\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyExtractorTool()\nexcept ImportError as e:\n    if \"required to use the TavilyExtractorTool\" in str(e):\n        log.error(\"User declined tavily install; provisioning dependency automatically\")\n        raise\n    raise","preventionTips":["Pre-install dependencies in Docker/CI images so prompts cannot be declined.","Run tools with stdin available or pre-installed deps when non-interactive.","Document tavily-python as a hard requirement for Tavily tools."],"tags":["tavily","installation","user-declined","import-error","crewai-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}