Skip to main content
Web Search lets your agents search the internet for up-to-date information. It works as both a programmatic function and an agent tool that the LLM can invoke automatically.

Supported Providers

ProviderStrengthsFree Tier
TavilyAI-native, returns clean content + AI answer1,000 req/month
ExaSemantic/neural search, find similar pages1,000 req/month
SerperReal Google results, very affordable2,500 credits
The simplest way to give your agent search capabilities:
import { Agent, openai, createWebSearchTool } from '@runflow-ai/sdk';

const agent = new Agent({
  name: 'Research Agent',
  instructions: 'You help users research topics using the internet.',
  model: openai('gpt-4o'),
  tools: {
    search: createWebSearchTool({
      provider: 'tavily',
      apiKey: process.env.TAVILY_API_KEY,
    }),
  },
});

const result = await agent.process({
  message: 'What are the latest developments in AI agents?',
});
The agent will automatically decide when to search the internet based on the user’s question. Use webSearch() directly in your code, workflows, or custom tools:
import { webSearch } from '@runflow-ai/sdk';

const results = await webSearch('Runflow AI platform', {
  provider: 'tavily',
  apiKey: process.env.TAVILY_API_KEY,
  maxResults: 5,
  searchDepth: 'advanced',
});

console.log(results.answer);   // AI-generated answer (Tavily)
console.log(results.results);  // Array of WebSearchResult

Response Format

{
  query: "Runflow AI platform",
  answer: "Runflow is an AI agent platform...",  // Tavily only
  results: [
    {
      title: "Runflow - Build AI Agents",
      url: "https://runflow.ai",
      snippet: "Platform for building and deploying AI agents...",
      content: "Full page content...",  // When includeContent is true
      score: 0.95,
      publishedDate: "2026-03-01"
    }
  ]
}

Two Modes: Standalone and Platform

Standalone Mode (API key in code)

Pass the API key directly. No platform connection needed:
createWebSearchTool({
  provider: 'tavily',
  apiKey: 'tvly-your-key',
})

Platform Mode (credential managed in portal)

Configure the search provider credential in the Runflow portal (Connectors > Search category), then use without an API key:
createWebSearchTool({
  provider: 'tavily',
  connector: 'tavily-default',  // Connector instance slug
})
The platform manages the API key securely via the connector credential system.

Provider Examples

const results = await webSearch('latest news about AI', {
  provider: 'tavily',
  apiKey: process.env.TAVILY_API_KEY,
  maxResults: 5,
  searchDepth: 'basic',     // 'basic' or 'advanced'
  includeContent: false,    // Include full page content
});
const results = await webSearch('articles about building AI agents', {
  provider: 'exa',
  apiKey: process.env.EXA_API_KEY,
  maxResults: 5,
});
Exa uses neural search — describe what you’re looking for in natural language for best results.

Serper (Google results)

const results = await webSearch('Runflow AI', {
  provider: 'serper',
  apiKey: process.env.SERPER_API_KEY,
  maxResults: 5,
});

Configuration Options

ParameterTypeDefaultDescription
provider'tavily' | 'exa' | 'serper''tavily'Search provider
apiKeystringProvider API key (standalone mode)
connectorstringConnector instance slug (platform mode)
maxResultsnumber5Maximum number of results
searchDepth'basic' | 'advanced''basic'Search depth (Tavily only)
includeContentbooleanfalseInclude full page content in results

Using in Workflows

import { flow, webSearch } from '@runflow-ai/sdk';

const researchFlow = flow('research')
  .step('search', async ({ input }) => {
    const results = await webSearch(input.query, {
      provider: 'tavily',
      apiKey: process.env.TAVILY_API_KEY,
    });
    return { results: results.results };
  })
  .step('summarize', {
    agent: summaryAgent,
    prompt: ({ results }) =>
      `Summarize these search results:\n${JSON.stringify(results.search.results)}`,
  })
  .build();

Next Steps

Schedule

Create scheduled executions programmatically

Tools

Create custom tools for agents