Integrate Valyu for Programmatic Content Access
LlamaIndex tool letting an agent search licensed content and the web via Valyu's deep search API.
Why it matters
Leverage Valyu's deep search API to programmatically access proprietary and web content. Enable AI agents to search and retrieve information from licensed sources and the broader web.
Outcomes
What it gets done
Connect to Valyu's Exchange Platform via API key or environment variable.
Utilize the ValyuToolSpec to integrate Valyu search capabilities into LlamaIndex agents.
Perform targeted searches with filters for sources, relevance, date, and response length.
Retrieve and process content from both proprietary and public web sources.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-tool-tools-valyu | bash Overview
LlamaIndex Tools Integration: Valyu
The Valyu Tool wires Valyu's deep search API into a LlamaIndex agent through a single search function, retrieving content from proprietary and public sources filterable by type, relevance, date range, source list, and response length. Use it when an agent needs deep, filterable search across licensed proprietary content and the web. It requires a Valyu API key.
What it does
This tool connects to Valyu and its Exchange Platform, letting an agent search and get content from programmatically licensed proprietary content and the web using Valyu's deep search API. It exposes a single function, search, which retrieves relevant content from proprietary and public sources, filterable by search type ("all", "proprietary", or "web"), relevance threshold, date range, source inclusion or exclusion, and response length.
When to use - and when NOT to
Use it when an agent needs deep, filterable search across both licensed proprietary content and the public web -- for example restricting a query to academic sources like arxiv.org and nature.com, or capping result length to a preset size. It requires a Valyu API key (obtainable from the Valyu developer dashboard, or set via the VALYU_API_KEY environment variable), so it is not usable without a Valyu account.
Inputs and outputs
Initialize with your API key and an optional max price, then attach to an agent:
### %pip install llama-index llama-index-core llama-index-tools-valyu
from llama_index.tools.valyu import ValyuToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
import os
valyu_tool = ValyuToolSpec(
api_key=os.environ["VALYU_API_KEY"],
max_price=100, # default is 100
)
agent = FunctionAgent(
tools=valyu_tool.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
print(
await agent.run(
"What are the implications of using different volatility calculation methods (EWMA vs. GARCH) in Value at Risk (VaR) modeling for fixed income portfolios?"
)
)
search can also be called directly with a query, included_sources/excluded_sources lists, a response_length (an integer character count, or a preset: short 25k, medium 50k, large 100k, max full content), max_num_results, and a relevance_threshold.
Who it's for
Developers building agents that need deep, source-filterable search across proprietary and public content, with fine control over relevance, date range, and result length.
Source README
LlamaIndex Tools Integration: Valyu
This tool connects to Valyu and its Exchange Platform to easily enable
your agent to search and get content from programmatically licensed proprietary content and the web using Valyu's deep search API.
To begin, you need to obtain an API key on the Valyu developer dashboard. You can also use the SDK without an API key by setting the VALYU_API_KEY environment variable.
Usage
Here's an example usage of the ValyuToolSpec.
### %pip install llama-index llama-index-core llama-index-tools-valyu
from llama_index.tools.valyu import ValyuToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
import os
valyu_tool = ValyuToolSpec(
api_key=os.environ["VALYU_API_KEY"],
max_price=100, # default is 100
)
agent = FunctionAgent(
tools=valyu_tool.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
print(
await agent.run(
"What are the implications of using different volatility calculation methods (EWMA vs. GARCH) in Value at Risk (VaR) modeling for fixed income portfolios?"
)
)
### You can also search directly with the new parameters
results = valyu_tool.search(
query="artificial intelligence trends 2024",
included_sources=[
"arxiv.org",
"nature.com",
], # Only search academic sources
response_length="medium", # 50k characters per result
max_num_results=3,
relevance_threshold=0.5,
)
search: Search and retrieve relevant content from proprietary and public sources using Valyu's deep search. Supports filtering by:
- Search type ("all", "proprietary", or "web")
- Relevance threshold
- Date ranges (start_date, end_date)
- Source filtering (included_sources, excluded_sources)
- Response length (integer for character count or preset values: "short" 25k, "medium" 50k, "large" 100k, "max" full content)
This loader is designed to be used as a way to load data as a Tool in a Agent.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.