Implementation:CrewAIInc CrewAI Linkup Search Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, Search, API_Integration |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
LinkupSearchTool integrates the Linkup API search platform into CrewAI agents for retrieving contextual information from the web.
Description
The LinkupSearchTool extends BaseTool to wrap the Linkup SDK client. It provides CrewAI agents with access to Linkup's contextual search capabilities, enabling retrieval of up-to-date information during task execution. The tool handles optional installation of the linkup-sdk package via interactive confirmation using click. It initializes a LinkupClient with an API key sourced either from the constructor parameter or the LINKUP_API_KEY environment variable. The _run method executes searches with configurable depth levels (standard or deep) and output types (searchResults, sourcedAnswer, or structured), returning structured results containing name, URL, and content for each search result. All responses include a success/failure status indicator.
Usage
Use this tool when a CrewAI agent needs to perform contextual web searches through the Linkup API, retrieving real-time information with configurable search depth and result formatting.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/linkup/linkup_search_tool.py
- Lines: 1-81
Signature
class LinkupSearchTool(BaseTool):
name: str = "Linkup Search Tool"
description: str = "Performs an API call to Linkup to retrieve contextual information."
_client: LinkupClient = PrivateAttr()
package_dependencies: list[str] = Field(default_factory=lambda: ["linkup-sdk"])
env_vars: list[EnvVar] = Field(default_factory=lambda: [
EnvVar(name="LINKUP_API_KEY", description="API key for Linkup", required=True),
])
def __init__(self, api_key: str | None = None) -> None: ...
def _run(
self,
query: str,
depth: Literal["standard", "deep"] = "standard",
output_type: Literal["searchResults", "sourcedAnswer", "structured"] = "searchResults",
) -> dict: ...
Import
from crewai_tools import LinkupSearchTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| api_key | str or None | No | Linkup API key; falls back to LINKUP_API_KEY environment variable |
| query | str | Yes | The search query to execute against the Linkup API |
| depth | Literal["standard", "deep"] | No | Search depth level; defaults to "standard" |
| output_type | Literal["searchResults", "sourcedAnswer", "structured"] | No | Desired result format; defaults to "searchResults" |
Outputs
| Name | Type | Description |
|---|---|---|
| _run() returns | dict | Dictionary with "success" boolean and either "results" list (each containing name, url, content) or "error" string |
Usage Examples
Basic Usage
from crewai_tools import LinkupSearchTool
tool = LinkupSearchTool(api_key="your-linkup-api-key")
result = tool._run(query="latest AI research papers")
Deep Search with Sourced Answer
from crewai_tools import LinkupSearchTool
tool = LinkupSearchTool() # Uses LINKUP_API_KEY env var
result = tool._run(
query="What are the latest trends in machine learning?",
depth="deep",
output_type="sourcedAnswer",
)