Skip to main content

Overview

Best for: building Valyu into your product / agents. Use Valyu as a search and content tool inside LangChain (Python) agents.
Viewing the Python integration. For the TypeScript version of this guide, see the TypeScript LangChain integration.
Valyu integrates seamlessly with LangChain as a search tool, 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 tools:
  • ValyuSearchTool: Search operations with comprehensive parameter control
  • ValyuContentsTool: Extract clean content from specific URLs

Paste into your AI assistant to wire Valyu into a LangChain (Python) agent.

Open in Cursor

Installation

Install the official LangChain Valyu package:
Configure credentials by setting the following environment variable:
Or set it programmatically:
For agent examples, you’ll also need:

Free Credits

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

Basic Usage

Using ValyuContentsTool for Content Extraction

Extract clean, structured content from specific URLs:

Using with LangChain Agents

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

Advanced configuration

ValyuContentsTool takes a single required urls argument (max 10 per request).
Bind a SystemMessage to guide tool selection. Use search_type="all" for broad coverage (web + proprietary), or "web" for current events only; raise relevance_threshold (0.6+) for precise results; cite sources; and use natural-language queries, not operators.See the Prompting Guide for full guidelines.

Additional Resources

LangChain Valyu Tool

Official LangChain integration documentation

API Reference

Complete Valyu API documentation

LangGraph Agents

Build advanced agent workflows

Get API Key

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