crewAIInc/crewAI · error · ImportError

You are missing the 'exa_py' package. Please install it to u

Error message

You are missing the 'exa_py' package. Please install it to use ExaSearchTool.

What it means

Raised by ExaSearchTool.__init__ when the 'exa_py' package is missing AND the user declined the interactive install prompt (click.confirm returned False). The tool tries to auto-install via 'uv add exa_py'; if you answer 'no' (or no TTY makes the confirm fail/decline), this ImportError is raised.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/exa_tools/exa_search_tool.py:108

        super().__init__(
            **kwargs,
        )
        global Exa
        if Exa is None:
            import click

            if click.confirm(
                "You are missing the 'exa_py' package. Would you like to install it?"
            ):
                import subprocess

                subprocess.run(["uv", "add", "exa_py"], check=True)  # noqa: S607

                from exa_py import Exa as _Exa

                Exa = _Exa  # type: ignore[misc]
            else:
                raise ImportError(
                    "You are missing the 'exa_py' package. Please install it to use ExaSearchTool."
                )

        client_kwargs: dict[str, str] = {}
        if self.api_key:
            client_kwargs["api_key"] = self.api_key
        if self.base_url:
            client_kwargs["base_url"] = self.base_url
        self.client = Exa(**client_kwargs)
        self.client.headers["x-exa-integration"] = "crewai"
        self.content = content
        self.summary = summary
        self.highlights = highlights
        self.type = type

    def _run(
        self,
        search_query: str,

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install it directly: uv add exa_py (or pip install exa_py), then retry.
  2. For CI/non-interactive runs, pre-install exa_py in the image or requirements so the prompt never appears.
  3. Alternatively, answer 'y' to the prompt in an interactive session and let the tool install it.

Example fix

# before: declines prompt -> ImportError
# after: shell
#   uv add exa_py
tool = ExaSearchTool(api_key=EXA_API_KEY)
Defensive patterns

Strategy: try-catch

Validate before calling

def exa_available() -> bool:
    try:
        import exa_py  # noqa: F401
        return True
    except ImportError:
        return False

Try / catch

try:
    tool = ExaSearchTool(api_key=KEY)
except ImportError as e:
    if 'exa_py' in str(e):
        raise SystemExit('Run: pip install exa_py') from e
    raise

Prevention

When it happens

Trigger: Instantiating ExaSearchTool without exa_py installed, then answering 'n' to the 'Would you like to install it?' prompt; running in a non-interactive context where click.confirm cannot prompt (it raises Abort, or defaults to declining).

Common situations: CI pipelines or containers hitting the interactive prompt with no TTY; a teammate's fresh clone without the optional dependency; mistakenly expecting silent auto-install.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/833b347062a93cff. Report an issue: GitHub.