For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started

Getting started with web search - basic usage, async patterns, agent integration

Learn how to integrate web search into your BoxLang AI applications with practical examples and patterns.

Basic Usage

The simplest way to search:

// Search with default HTTP provider
var results = aiWebSearch( "BoxLang programming language" )

// Results is an array of search result structs
results.each( result => {
    println( "Title: #result.title#" )
    println( "URL: #result.url#" )
    println( "Snippet: #result.snippet#" )
    println( "---" )
} )

Selecting a Provider

// Use HTTP (default) - no API key needed
var results = aiWebSearch( "AI news", { provider: "http" } )

// Use Brave Search
var results = aiWebSearch(
    "AI news",
    { provider: "brave", maxResults: 10 }
)

// Use Google Custom Search
var results = aiWebSearch(
    "BoxLang",
    { provider: "google", maxResults: 5 }
)

// Use Tavily (AI-optimized)
var results = aiWebSearch(
    "latest AI models",
    { provider: "tavily", maxResults: 15 }
)

// Use Exa (neural/semantic)
var results = aiWebSearch(
    "semantic search techniques",
    { provider: "exa", maxResults: 5 }
)

Limiting Results

For better performance when not blocking on results:

Working with Results

Filtering Results

Extracting Data

Sorting Results

Agent Integration

Multi-Tool Agent

Research Task Agent

With Memory

Combining Web Search and Conversation Memory

Web Search + Vector Memory (RAG)

Error Handling

Catching Search Errors

Rate Limiting

Performance Tips

Caching Results

Parallel Searches

Next Steps

Last updated