LinkupWebSearch
Search the web using the Linkup API and return results as Haystack Documents.
Key Features
- Uses the Linkup Search API, which is optimized for LLM applications.
- Supports three search depths:
fast(sub-second, beta),standard(simple search), anddeep(agentic workflow with higher quality). - Returns structured documents with content and URL links.
- Supports per-run overrides of
top_k,depth, and search parameters. - Supports domain filtering, date range filtering, and image inclusion through
search_params.
Configuration
- Drag the
LinkupWebSearchcomponent onto the canvas from the Component Library. - Click on the component to open the configuration panel.
- On the General tab:
- Create a secret with your Linkup API key and set it as
api_key. UseLINKUP_API_KEYas the environment variable name. For instructions, see Create Secrets. - Set
top_kto control the maximum number of results (default: 10). - Set
depthtofast,standard, ordeepdepending on your latency and quality requirements.
- Create a secret with your Linkup API key and set it as
- Go to the Advanced tab to configure
search_paramsfor domain and date filters.
Connections
LinkupWebSearch receives a query string and returns a list of Document objects and a list of URLs. Connect its documents output to downstream components such as PromptBuilder for retrieval-augmented generation.
Source Code
To check this component's source code, open linkup_websearch.py in the Haystack Core Integrations repository.
Usage Examples
Basic Configuration
LinkupWebSearch:
type: haystack_integrations.components.websearch.linkup.linkup_websearch.LinkupWebSearch
init_parameters:
api_key:
type: env_var
env_vars:
- LINKUP_API_KEY
strict: false
top_k: 5
depth: standard
Using the Component in a Pipeline
# haystack-pipeline
components:
websearch:
type: haystack_integrations.components.websearch.linkup.linkup_websearch.LinkupWebSearch
init_parameters:
api_key:
type: env_var
env_vars:
- LINKUP_API_KEY
strict: false
top_k: 5
depth: standard
prompt_builder:
type: haystack.components.builders.chat_prompt_builder.ChatPromptBuilder
init_parameters:
required_variables: "*"
template:
- role: user
content: |
Answer the question using the following search results:
{% for doc in documents %}
{{ doc.content }}
{% endfor %}
Question: {{ question }}
llm:
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
init_parameters:
api_key:
type: env_var
env_vars:
- OPENAI_API_KEY
strict: false
model: gpt-4o-mini
connections:
- sender: websearch.documents
receiver: prompt_builder.documents
- sender: prompt_builder.prompt
receiver: llm.messages
max_runs_per_component: 100
metadata: {}
inputs:
query:
- websearch.query
- prompt_builder.question
outputs:
replies: llm.replies
Parameters
Inputs
| Parameter | Type | Description |
|---|---|---|
query | str | The search query string. |
Outputs
| Parameter | Type | Description |
|---|---|---|
documents | List[Document] | A list of documents containing search result content. |
links | List[str] | A list of URLs from the search results. |
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | Secret | Secret.from_env_var("LINKUP_API_KEY") | The Linkup API key. |
top_k | Optional[int] | 10 | Maximum number of results to return. Maps to the max_results parameter of the Linkup API. |
depth | str | standard | Search depth: "fast" (sub-second, beta, keyword-based queries only), "standard" for a simple search, or "deep" for a more powerful agentic workflow. |
search_params | Optional[Dict[str, Any]] | None | Additional parameters for the Linkup API. Supported keys include include_images, from_date, to_date, include_domains, and exclude_domains. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
query | str | The search query string. | |
top_k | Optional[int] | None | Per-run override of the maximum number of results. |
depth | Optional[str] | None | Per-run override of the search depth ("fast", "standard", or "deep"). |
search_params | Optional[Dict[str, Any]] | None | Per-run override of search parameters. If provided, fully replaces the init-time search_params. |
Related Information
Was this page helpful?