Edge Developer Platform
  • Pages
    • Product Introduction
    • Quick Start
      • Agent Development
      • Importing a Git Repository
      • Starting From a Template
      • Direct Upload
      • Start with AI
    • Framework Guide
      • Agent
      • Frontends
        • Vite
        • React
        • Vue
        • Hugo
        • Other Frameworks
      • Backends
      • Full-stack
        • Next.js
        • Nuxt
        • Astro
        • React Router
        • SvelteKit
        • TanStack Start
        • Vike
      • Custom 404 Page
    • Project Guide
      • Project Management
      • edgeone.json
      • Configuring Cache
      • Building Output Configuration
      • Error Codes
    • Build Guide
    • Deployment Guide
      • Overview
      • Create Deploys
      • Manage Deploys
      • Deploy Button
      • Using Github Actions
      • Using Gitlab CI/CD
      • Using CNB Plugin
      • Using IDE PlugIn
      • Using CodeBuddy IDE
    • Domain Management
      • Overview
      • Custom Domain
      • HTTPS Configuration
        • Overview
        • Apply for Free Certificate
        • Using Managed SSL Certificate
      • Configure DNS CNAME Record
    • Observability
      • Overview
      • Metric Analysis
      • Log Analysis
    • Functions
      • Overview
      • Edge Functions
      • Cloud Functions
        • Overview
        • Node.js
        • Python
        • Go
    • Agents
      • Overview
      • Quick Start
      • Conversation Storage
      • Observability
      • Sandbox Tool
        • Overview
        • Using the Agent Framework
        • Sandbox Atomic API
        • Network Search Tool
      • Agent Authentication
    • Models
      • Overview
      • Models and Vendors
        • Overview
        • Using Vendor Keys
          • OpenAI
          • Anthropic
          • Google AI Studio
          • DeepSeek
          • MiniMax
          • Hunyuan
          • Zhipu
          • MoonShot AI
      • FAQs
    • Storage
      • Overview
      • KV
      • Blob
    • Middleware
    • AI-Native Development
      • Skills
      • MCP
    • Copilot
      • Overview
      • Quick Start
    • API Token
    • EdgeOne CLI
    • Message Notification
    • Integration Guide
      • AI
        • Dialogue Large Models Integration
        • Large Models for Images Integration
      • Database
        • Supabase Integration
        • Pages KV Integration
      • Ecommerce
        • Shopify Integration
        • WooCommerce Integration
      • Payment
        • Stripe Integration
        • Integrating Paddle
      • CMS
        • WordPress Integration
        • Contentful Integration
        • Sanity Integration
        • Payload Integration
      • Authentication
        • Supabase Integration
        • Clerk Integration
    • Best Practices
      • Adding an AI Chat Assistant to a Website
      • AI Dialogue Deployment: Deploy Project with One Sentence Using Skill
      • Using General Large Model to Quickly Build AI Application
      • Use the DeepSeek model to quickly build a conversational AI site
      • Building an Ecommerce Platform with Shopify
      • Building a SaaS Site Using Supabase and Stripe
      • Building a Company Brand Site Quickly
      • How to Quickly Build a Blog Site
    • Migration Guides
      • Migrating from Vercel to EdgeOne Makers
      • Migrating from Cloudflare Pages to EdgeOne Makers
      • Migrating from Netlify to EdgeOne Makers
    • Troubleshooting
    • FAQs
    • Limits
    • Pricing
    • Contact Us
    • Release Notes

Network Search Tool

web_search is a public network search tool sample provided by the platform. It calls the Tencent Cloud Web Search (WSA) API at the underlying layer and is suitable for LLMs to use when they need to discover information, query data, or obtain the latest content. Developers can also integrate third-party search services or customize search tools based on their business scenarios.

Prerequisites for Enabling

Configure the environment variable WSA_API_KEY: write it to the project .env file in the dev environment, and to the console environment variables in the production environment. If it is missing, the system will prompt web_search requires the WSA_API_KEY environment variable....
The root account needs to activate the Web Search (WSA) service in the Tencent Cloud console and refer to the WSA API documentation.
This environment variable is optional during deployment. After deployment succeeds, you can still add it in the project settings of the console.

Parameters

Field
Type
Required
Default Value
Description
query
string
Yes
The search keyword, which cannot be an empty string.
maxResults
integer ≥ 1
No
5
The maximum number of deduplicated results returned (deduplicated by href).
site
string
No
Site search: limit the results to a single domain, for example, "zhihu.com" or "cloud.tencent.com".
Omitting this parameter indicates a web-wide search.

Return Values

Returns SearchResult[] — a deduplicated result array (deduplicated by href, with a length less than or equal to maxResults). Fields for each item:
Field
Type
Description
title
string
Result title (trimmed)
href
string
Target URL (WSA directly returns the real accessible address, no need to follow redirects)
snippet
string
Snippet, corresponding to the content / passage in WSA
site
string
Source site name (may be empty for some small sites)
date
string
Content publication date (may be empty)

TS Sample

// Search the entire web
const webSearch = context.tools.get('web_search')
const results = await webSearch.execute({
query: 'What are the latest AI technologies?'
})
// results: [{ title, href, snippet, site, date }, ...]


Python Sample

# Search the entire web
web_search = context.tools.get('web_search')
results = await web_search['execute']({
'query': 'What are the latest AI technologies?'
})

Third-Party Search Service

If you do not want to use Tencent Cloud WSA, you can integrate third-party search services (such as Exa, Tavily, and so on).

Recommended Integration Method: Custom Tool + Disabling the Built-in web_search

Package third-party calls into an object that matches the tool form adapted to the framework. Then, when mounting it to the Agent, filter out the built-in web_search to prevent the LLM from seeing two tools with the same purpose simultaneously.
TS example (Exa + OpenAI Agents)
import Exa from 'exa-js'
import { tool } from '@openai/agents'
import { z } from 'zod'

const exa = new Exa(process.env.EXA_API_KEY!)

// 1) Package third-party calls as native framework tools
const exaSearch = tool({
name: 'web_search',
description: 'Search the public web. Returns title / url / snippet for top results.',
parameters: z.object({
query: z.string().describe('Search keywords'),
maxResults: z.number().int().min(1).default(5),
}),
execute: async ({ query, maxResults }) => {
const { results } = await exa.search(query, {
numResults: maxResults,
contents: { highlights: true },
})
return results.map((r) => ({
title: r.title ?? '',
href: r.url,
snippet: r.highlights?.[0] ?? r.text?.slice(0, 200) ?? '',
site: new URL(r.url).hostname,
date: r.publishedDate ?? '',
}))
},
})

// 2) Filter out the built-in web_search during mounting to avoid conflicts with custom tools.
const tools = [
...context.tools.all().filter((t) => t.name !== 'web_search'),
exaSearch,
]