-
Notifications
You must be signed in to change notification settings - Fork 1
Web Access
Edge adaptation of the upstream web search and fetch capability.
The web access subsystem gives the model two tools for retrieving information from the internet:
-
web_search— sends search queries to a configured provider, returns an answer snippet + ranked source URLs. Multi-query support (up to 5 concurrent queries per tool call). -
web_fetch— retrieves the full content of a URL, converts HTML to model-readable text, truncates to a configurable character limit. Handles redirects, blocked URLs, and content-type detection.
Three packages compose the capability:
-
WebRuntime (
ctx.web) — capability seam with provider registries for both search and fetch. Provider selection, cancellation, and error handling. - DeepSeekWebSearch — search provider calling the DeepSeek search API (Anthropic-compatible endpoint).
-
ToolWeb — registers the model-facing tools. Configurable:
{ search: boolean, fetch: boolean }controls which tools are exposed.
installEdgeWebSearch() installs all three packages with { search: true, fetch: false }:
-
WebRuntime— search provider set to DeepSeek -
DeepSeekWebSearch— configurable base URL viaDEEPSEEK_SEARCH_BASE_URLenv var -
ToolCallTimeoutPolicy— enforces per-call timeouts -
ToolWeb—web_searchtool registered,web_fetchtool not registered
The model sees web_search in its tool list and can search the web. The system prompt adjusts accordingly — without web_fetch, the model is told to use source snippets directly rather than following up with a fetch.
web_fetch is disabled via config (fetch: false). The upstream fetch capability requires:
- An HTTP client that can follow redirects and handle various content types
- HTML-to-text conversion (upstream has a built-in HTML parser + markdown renderer)
- URL validation and blocking (prevent SSRF, local network access)
Workers' built-in fetch() API can make HTTP requests, and upstream's HTML-to-text conversion runs in pure JS — no Node.js dependency. The technical blockers are policy, not platform:
-
SSRF risk: Workers'
fetch()can reach internal Cloudflare services and potentially other Workers. Upstream's URL validator may need Edge-specific additions. - Egress cost: fetched pages count against Workers' subrequest limits and bandwidth.
- Content rendering: complex pages (SPAs, JS-rendered content) need a browser engine, not just HTTP fetch.
- WebRuntime capability seam (provider selection, cancellation, error handling)
- DeepSeek search provider implementation
-
web_searchtool schema, multi-query support, source formatting - ToolCallTimeoutPolicy enforcement
Each web_search call makes an HTTP request to the DeepSeek search API. Latency is dominated by the external API response time (typically 500ms–2s). Multiple queries within one tool call run concurrently (up to 5). The timeout policy enforces an upper bound.
Since web_fetch is disabled, there is zero overhead from page fetching. The model works with search result snippets only.
| Approach | Capability | Plan | Complexity |
|---|---|---|---|
Workers fetch()
|
Basic HTTP: HTML pages, JSON APIs, text files | Free | Low — enable fetch: true, add SSRF guards |
| Browser Rendering API | Full page rendering: SPAs, JS-heavy sites, screenshots | Workers Paid | Medium — need fetch provider wrapping the Rendering API |
The simplest path is enabling Workers fetch() with SSRF protection — upstream's HTML parser is pure JS and already works in the Worker runtime. Browser Rendering adds full-page capability but requires a paid plan and a custom fetch provider.
| Component | Category | Edge Code |
|---|---|---|
| WebRuntime | Reuse | One ctx.plugin() call |
| DeepSeekWebSearch | Reuse | One ctx.plugin() call |
| ToolWeb (search only) | Reuse | { search: true, fetch: false } |
web_fetch |
Config flag — no code removed |
Key observation: Web search is fully upstream code — zero Edge adaptation beyond the config flag. Enabling
web_fetchis a config change + SSRF policy decision, not a platform limitation.
Enable
web_fetchwith SSRF guards. Upstream's HTML-to-text converter is pure JS and works in Workers. The main work is adding URL validation rules to prevent local-network and internal-service access. Change{ search: true, fetch: false }to{ search: true, fetch: true }and register a fetch provider backed by Workersfetch(). Available on free plan.
Evaluate Browser Rendering for rich page content. For JS-rendered pages that Workers
fetch()can't handle, Cloudflare's Browser Rendering API provides a headless Chromium. Requires Workers Paid plan. Would need a customWebFetchProviderthat renders the page and extracts text.
- Home
- Architecture
- Core & Scope
- Session & Persistence
- Model & Context
-
Execution & Tools
- Tools
- Bash
- Subprocess 🚫
- PTY Session 🚫
- Background Jobs 🚫
- Filesystem
- LSP Navigation 🚫
- Code Runtime 🚫
-
Web Access
⚠️ -
Skills
⚠️ - Workflow 🚫
- Subagent 🚫
-
Policy & Interaction
- Goal
- Approval 🚫
- Permission Presets 🚫
-
Sandbox
⚠️ - Plan Mode 🚫
- User Interaction 🚫
- Commands 🚫
- Schedule 🚫
- Message Feedback 🚫
- Platform & Access
- Development
- 首页
- 架构
- 核心与作用域
- 会话与持久化
- 模型与上下文
- 执行与工具
- 策略与交互
- 平台与接入
- 开发