Linkup Search Tool
LinkupSearchTool
Section titled “LinkupSearchTool”Description
Section titled “Description”The 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.
Installation
Section titled “Installation”To use this tool, you need to install the Linkup SDK:
uv add linkup-sdkSteps to Get Started
Section titled “Steps to Get Started”To effectively use the LinkupSearchTool, follow these steps:
- API Key: Obtain a Linkup API key.
- Environment Setup: Set up your environment with the API key.
- Install SDK: Install the Linkup SDK using the command above.
Example
Section titled “Example”The following example demonstrates how to initialize the tool and use it in an agent:
from crewai_tools import LinkupSearchToolfrom crewai import Agentimport os
# Initialize the tool with your API keylinkup_tool = LinkupSearchTool(api_key=os.getenv("LINKUP_API_KEY"))
# Define an agent that uses the tool@agentdef 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] )Parameters
Section titled “Parameters”The LinkupSearchTool accepts the following parameters:
Constructor Parameters
Section titled “Constructor Parameters”- api_key: Required. Your Linkup API key.
Run Parameters
Section titled “Run Parameters”- query: Required. The search term or phrase.
- depth: Optional. The search depth. Default is “standard”.
- output_type: Optional. The type of output. Default is “searchResults”.
Advanced Usage
Section titled “Advanced Usage”You can customize the search parameters for more specific results:
# Perform a search with custom parametersresults = linkup_tool.run( query="Women Nobel Prize Physics", depth="deep", output_type="searchResults")Return Format
Section titled “Return Format”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"}Error Handling
Section titled “Error Handling”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.
Conclusion
Section titled “Conclusion”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.