Prerequisites
The following example requires thevalyu and openai libraries and an API key from Valyu.
uv pip install -U valyu openai
export VALYU_API_KEY=***
Example
The following agent can perform academic and web searches:from agno.agent import Agent
from agno.tools.valyu import ValyuTools
agent = Agent(
instructions=[
"You are a research assistant that helps find academic papers and web content",
"Use Valyu to search for high-quality, relevant information",
"Provide detailed analysis of search results with relevance scores",
"Focus on credible sources and academic publications",
],
tools=[ValyuTools()],
)
agent.print_response("Find recent research papers about machine learning in healthcare", stream=True)
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | Optional[str] | None | Valyu API key. Uses VALYU_API_KEY if not set. |
enable_academic_search | bool | True | Enable academic sources search functionality. |
enable_web_search | bool | True | Enable web search functionality. |
enable_paper_search | bool | True | Enable search within paper functionality. |
all | bool | False | Enable all tools. Overrides individual flags when True. |
text_length | int | 1000 | Maximum length of text content per result. |
max_results | int | 10 | Maximum number of results to return. |
relevance_threshold | float | 0.5 | Minimum relevance score for results. |
content_category | Optional[str] | None | Content category for filtering. |
search_start_date | Optional[str] | None | Start date for search filtering (YYYY-MM-DD). |
search_end_date | Optional[str] | None | End date for search filtering (YYYY-MM-DD). |
search_domains | Optional[List[str]] | None | Currently has no effect. The value is stored but never sent to the Valyu API. |
sources | Optional[List[str]] | None | List of specific sources to search. |
max_price | float | 30.0 | Maximum price for API calls. |
tool_call_mode | bool | False | Pass is_tool_call=True to the Valyu search API. |
Toolkit Functions
| Function | Description |
|---|---|
search_academic_sources | Search academic sources for research papers and publications. |
search_web | Search web sources for general information and content. |
search_within_paper | Search within a specific ArXiv paper for detailed information. |