docs/en/tools/search-research/linkupsearchtool.mdx
LinkupSearchToolThe LinkupSearchTool provides the ability to query the Linkup API for contextual information and retrieve structured results. This tool is ideal for enriching workflows with up-to-date and reliable information from Linkup, allowing agents to access relevant data during their tasks.
To use this tool, you need to install the Linkup SDK:
uv add linkup-sdk
To effectively use the LinkupSearchTool, follow these steps:
The following example demonstrates how to initialize the tool and use it in an agent:
from crewai_tools import LinkupSearchTool
from crewai import Agent
import os
# Initialize the tool with your API key
linkup_tool = LinkupSearchTool(api_key=os.getenv("LINKUP_API_KEY"))
# Define an agent that uses the tool
@agent
def researcher(self) -> Agent:
'''
This agent uses the LinkupSearchTool to retrieve contextual information
from the Linkup API.
'''
return Agent(
config=self.agents_config["researcher"],
tools=[linkup_tool]
)
The LinkupSearchTool accepts the following parameters:
You can customize the search parameters for more specific results:
# Perform a search with custom parameters
results = linkup_tool.run(
query="Women Nobel Prize Physics",
depth="deep",
output_type="searchResults"
)
The tool returns results in the following format:
{
"success": true,
"results": [
{
"name": "Result Title",
"url": "https://example.com/result",
"content": "Content of the result..."
},
// Additional results...
]
}
If an error occurs, the response will be:
{
"success": false,
"error": "Error message"
}
The tool gracefully handles API errors and provides structured feedback. If the API request fails, the tool will return a dictionary with success: false and an error message.
The LinkupSearchTool provides a seamless way to integrate Linkup's contextual information retrieval capabilities into your CrewAI agents. By leveraging this tool, agents can access relevant and up-to-date information to enhance their decision-making and task execution.