crewAIInc/crewAI · error · ImportError

The 'linkup-sdk' package is required to use the LinkupSearch

Error message

The 'linkup-sdk' package is required to use the LinkupSearchTool. Please install it with: uv add linkup-sdk

What it means

LinkupSearchTool tries to import LinkupClient; on ImportError it interactively offers to install linkup-sdk via `uv add`. If stdin is not a TTY (or the user declines the click.confirm prompt), it raises this ImportError telling you to install the SDK manually. The interactive prompt makes it especially fragile in CI and non-interactive agent runs.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/linkup/linkup_search_tool.py:50

    def __init__(self, api_key: str | None = None) -> None:
        """Initialize the tool with an API key."""
        super().__init__()  # type: ignore[call-arg]
        try:
            from linkup import LinkupClient
        except ImportError:
            import click

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

                subprocess.run(["uv", "add", "linkup-sdk"], check=True)  # noqa: S607
                from linkup import LinkupClient

            else:
                raise ImportError(
                    "The 'linkup-sdk' package is required to use the LinkupSearchTool. "
                    "Please install it with: uv add linkup-sdk"
                ) from None
        self._client = LinkupClient(api_key=api_key or os.getenv("LINKUP_API_KEY"))

    def _run(
        self,
        query: str,
        depth: Literal["standard", "deep"] = "standard",
        output_type: Literal[
            "searchResults", "sourcedAnswer", "structured"
        ] = "searchResults",
    ) -> dict[str, Any]:
        """Executes a search using the Linkup API.

        :param query: The query to search for.
        :param depth: Search depth (default is "standard").
        :param output_type: Desired result type (default is "searchResults").

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install the SDK in the runtime environment: `uv add linkup-sdk` or `pip install linkup-sdk`
  2. Add linkup-sdk to your requirements/pyproject so CI never reaches the interactive prompt
  3. Set LINKUP_API_KEY as well so the client initializes correctly after install

Example fix

# before
tool = LinkupSearchTool()  # ImportError: requires linkup-sdk

# after
# uv add linkup-sdk  (or pip install linkup-sdk)
import os
os.environ["LINKUP_API_KEY"] = "..."
tool = LinkupSearchTool()
Defensive patterns

Strategy: validation

Validate before calling

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

assert linkup_ready(), "uv add linkup-sdk (run before starting the crew)"

Try / catch

try:
    from crewai_tools.tools.linkup.linkup_search_tool import LinkupSearchTool
    tool = LinkupSearchTool()
except ImportError as e:
    raise RuntimeError("Install linkup-sdk before using LinkupSearchTool") from e

Prevention

When it happens

Trigger: Instantiating LinkupSearchTool() without linkup-sdk installed; running in CI/containers where click.confirm gets EOF and returns False; answering 'no' to the install prompt.

Common situations: Deploying to Docker/CI where no TTY exists so the confirm prompt auto-fails; environments without `uv` on PATH so even accepting the prompt would crash; fresh clones that only ran `pip install crewai-tools`.

Related errors


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