Want to try without writing any code? Test our search tools and see results in our AI SDK Playground.
1
Installation
Installation
Install the Valyu AI SDK package:.env file:2
Quick Start
Quick start
Get started with web search in seconds:3
Available Search Tools
Available search tools
Each tool is called the same way -tools: { name: toolName() }. Route each query to the most specific tool:Discovery tools (
datasources, datasourcesCategories) let an agent list the available sources and categories before searching.companyResearch auto-detects whether a company is public or private and pulls from filings, financials, news, and funding accordingly. It supports section filtering (summary, leadership, products, funding, competitors, filings, financials, news, insiders).4
Combine multiple tools
Combine multiple tools
Register several tools so the agent chooses per query:generateText for streamText and iterate result.textStream.5
Configuration and best practices
Configuration and best practices
Tool configuration options
Tool configuration options
maxNumResults and raise relevanceThreshold to control cost. Each tool call is a separate Search request. See pricing.System prompting
System prompting
Guide the model to route to the right tool, cite sources as Markdown links
[Title](URL), combine tools for complex topics, and use natural-language queries (not operators). See the Prompting Guide.Build a custom tool
Build a custom tool
Call the Search API directly with the AI SDK
tool() helper:TypeScript types
TypeScript types
Full types ship with the package:
ValyuBaseConfig, ValyuWebSearchConfig, and per-tool config types (ValyuFinanceSearchConfig, ValyuPaperSearchConfig, etc.), plus ValyuSearchResult and ValyuApiResponse.Next steps
- Search prompting - Write focused queries and preserve source links.
- TypeScript SDK - Call other Valyu endpoints directly.
- Package source - Review tool definitions and supported versions.