{"record":{"id":"d51369187626c1fa","repo":"crewAIInc/crewAI","slug":"the-tavily-python-package-is-required-to-use-the-d51369","errorCode":null,"errorMessage":"The 'tavily-python' package is required to use the TavilyResearchTool. Please install it with: uv add tavily-python","messagePattern":"The 'tavily-python' package is required to use the TavilyResearchTool\\. 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_research_tool/tavily_research_tool.py","lineNumber":127,"sourceCode":"                ) from e\n\n            if click.confirm(\n                \"You are missing the 'tavily-python' package, which is required \"\n                \"for TavilyResearchTool. Would you like to install it?\"\n            ):\n                try:\n                    subprocess.run([\"uv\", \"add\", \"tavily-python\"], check=True)  # noqa: S607\n                    raise ImportError(\n                        \"'tavily-python' has been installed. Please restart your \"\n                        \"Python application to use the TavilyResearchTool.\"\n                    )\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\n                        f\"Attempted to install 'tavily-python' but failed: {e}. \"\n                        \"Please install it manually to use the TavilyResearchTool.\"\n                    ) from e\n            else:\n                raise ImportError(\n                    \"The 'tavily-python' package is required to use the \"\n                    \"TavilyResearchTool. Please install it with: uv add tavily-python\"\n                )\n\n    @staticmethod\n    def _stringify_response(response: Any) -> str:\n        if isinstance(response, str):\n            return response\n        return json.dumps(response, indent=2)\n\n    def _run(\n        self,\n        input: str,\n        model: Literal[\"mini\", \"pro\", \"auto\"] | None = None,\n        output_schema: dict[str, Any] | None = None,\n        stream: bool | None = None,\n        citation_format: Literal[\"numbered\", \"mla\", \"apa\", \"chicago\"] | None = None,\n    ) -> str | Generator[bytes, None, None]:","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_research_tool/tavily_research_tool.py#L109-L145","documentation":"TavilyResearchTool raises this ImportError in the branch where the user declines the interactive install prompt. No install is attempted; the tool simply refuses to be usable without tavily-python and points to `uv add tavily-python`.","triggerScenarios":"TavilyResearchTool.__init__ with tavily-python missing and click.confirm answered 'n' (or declined implicitly in non-TTY contexts).","commonSituations":"Interactive terminals where the developer opts out; scripts whose stdin is not a TTY.","solutions":["Install tavily-python (uv add tavily-python or pip install tavily-python) and re-construct the tool.","Bake the dependency into your environment/image to avoid prompts entirely."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec(\"tavily\") is None:\n    raise SystemExit(\"tavily-python required for TavilyResearchTool. Install: uv add tavily-python\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyResearchTool()\nexcept ImportError as e:\n    if \"required to use the\" in str(e):\n        log.warning(\"Tavily install declined at prompt; tool unavailable\")\n    raise","preventionTips":["Pre-install dependencies in build images to eliminate prompts.","Make Tavily deps explicit in requirements so no interactive step exists.","Automate stdin handling (or lack thereof) deliberately in scripts."],"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"}