> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Valyu Deep search integrations

> Integrate with Valyu Deep search using LangChain Python.

> [Valyu](https://www.valyu.network/) allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.

This notebook goes over how to use Valyu in LangChain.

First, get a Valyu API key and add it as an environment variable. Get \$10 free credit  by [signing up here](https://platform.valyu.network/).

## Setup

The integration lives in the `langchain-valyu` package.

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install -qU langchain-valyu
```

In order to use the package, you will also need to set the `VALYU_API_KEY` environment variable to your Valyu API key.

## Context retriever

You can use the [`ValyuContextRetriever`](https://pypi.org/project/langchain-valyu/) in a standard retrieval pipeline.

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_valyu import ValyuRetriever

valyu_api_key = "YOUR API KEY"

# Create a new instance of the ValyuRetriever
valyu_retriever = ValyuRetriever(
    k=5,
    search_type="all",
    relevance_threshold=0.5,
    max_price=20.0,
    start_date="2024-01-01",
    end_date="2024-12-31",
    valyu_api_key=valyu_api_key,
)

# Search for a query and save the results
docs = valyu_retriever.invoke("What are the benefits of renewable energy?")

# Print the results
for doc in docs:
    print(doc.page_content)
    print(doc.metadata)
```

## Context search tool

You can use the `ValyuSearchTool` for advanced search queries.

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_valyu import ValyuSearchTool

# Initialize the ValyuSearchTool
search_tool = ValyuSearchTool(valyu_api_key="YOUR API KEY")

# Perform a search query
search_results = search_tool._run(
    query="What are agentic search-enhanced large reasoning models?",
    search_type="all",
    max_num_results=5,
    relevance_threshold=0.5,
    max_price=20.0,
    start_date="2024-01-01",
    end_date="2024-12-31",
)

print("Search Results:", search_results)
```

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/providers/valyu.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
