{"record":{"id":"7fa755b239089f98","repo":"crewAIInc/crewAI","slug":"the-tavily-python-package-is-required-to-use-the-7fa755","errorCode":null,"errorMessage":"The 'tavily-python' package is required to use the TavilyGetResearchTool. Please install it with: uv add tavily-python","messagePattern":"The 'tavily-python' package is required to use the TavilyGetResearchTool\\. 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_get_research_tool/tavily_get_research_tool.py","lineNumber":91,"sourceCode":"                ) from e\n\n            if click.confirm(\n                \"You are missing the 'tavily-python' package, which is required \"\n                \"for TavilyGetResearchTool. 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 TavilyGetResearchTool.\"\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 TavilyGetResearchTool.\"\n                    ) from e\n            else:\n                raise ImportError(\n                    \"The 'tavily-python' package is required to use the \"\n                    \"TavilyGetResearchTool. 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(self, request_id: str) -> str:\n        \"\"\"Synchronously retrieves Tavily research task status and results.\"\"\"\n        if not self._client:\n            raise ValueError(\n                \"Tavily client is not initialized. Ensure 'tavily-python' is \"\n                \"installed and API key is set.\"\n            )\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/tavily_get_research_tool/tavily_get_research_tool.py#L73-L109","documentation":"TavilyGetResearchTool raises this ImportError when the operator declines the interactive install prompt (click.confirm returns False). It is the refusal branch: no dependency was installed and the tool cannot function, so construction aborts with explicit install instructions (uv add tavily-python).","triggerScenarios":"TavilyGetResearchTool.__init__ with tavily-python absent and the confirm prompt answered 'n' (or effectively declined under non-interactive stdin).","commonSituations":"Interactive shells where the user says no; automated scripts with closed stdin causing click.confirm to decline/abort.","solutions":["Install the package: uv add tavily-python (or pip install tavily-python), then re-create the tool.","Pre-install dependencies in your Dockerfile/CI so interactive prompts never appear.","Run tools non-interactively only after tavily-python is present in the image/env."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec(\"tavily\") is None:\n    raise SystemExit(\"tavily-python required. Install: uv add tavily-python\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = TavilyGetResearchTool()\nexcept ImportError as e:\n    if \"required to use the\" in str(e):\n        log.error(\"Install declined; aborting Tavily tool setup\")\n    raise","preventionTips":["Pre-install tavily-python in images/CI so no confirmation prompt appears.","Keep stdin interactive OR dependencies pre-installed; never both missing.","List Tavily dependencies explicitly in project requirements."],"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-15T17:31:12.345Z"}