Skip to main content

Overview

Best for: building Valyu into your product / agents. Use Valyu as a tool spec inside LlamaIndex agents and RAG apps.
Valyu integrates seamlessly with LlamaIndex as a comprehensive tool spec, allowing you to enhance your AI agents and RAG applications with real-time web search and proprietary data sources. The integration provides LLM-ready context from multiple sources including web pages, academic journals, financial data, and more. The package includes two main functions:
  • search(): Search operations with comprehensive parameter control
  • get_contents(): Extract clean content from specific URLs

Paste into your AI assistant to wire Valyu into a LlamaIndex agent.

Open in Cursor

Installation

Install the official LlamaIndex Valyu package:
Configure your credentials by setting the following environment variable:

Free Credits

Get your API key with $10 free credits ($20 with a work email) from the Valyu Platform.

Basic Usage

Using ValyuToolSpec for Content Extraction

Using with LlamaIndex OpenAI Agents

The most powerful way to use Valyu is within LlamaIndex agents, where the AI can dynamically decide when and how to search:

Advanced configuration

Set search defaults at initialization, override per call:
get_contents(urls=[...]) extracts clean content from URLs (max 10 per request).
Pass a system_prompt to your agent: use search_type="all" for broad coverage (web + proprietary), or "web" for current events only; raise relevance_threshold (0.6+) for precision; cite sources; use natural-language queries, not operators. See the Prompting Guide.
Wrap ValyuToolSpec.search() in a CustomQueryEngine or BaseRetriever to plug Valyu into existing LlamaIndex pipelines - call search() in custom_query/_retrieve and map each result doc (with doc.metadata['relevance_score']) into your response or NodeWithScore objects.

Additional Resources

LlamaIndex Valyu Tool

Official LlamaIndex tool documentation

API Reference

Complete Valyu API documentation

LlamaHub

Valyu tool on LlamaHub

Get API Key

Sign up for $10 free credits ($20 with a work email)