返回 文章 apply CMS 文章

Cloudflare 推出 Search for Agents:一键让 AI 代理搜索你的网站

一键开启,让 AI 代理通过标准 API 搜索你的网站内容。

CloudflareAI SearchAI 代理网站搜索
成长分 / 100 72 综合收获、行动、留存与影响

Cloudflare 推出 Search for Agents:一键让 AI 代理搜索你的网站
为什么值得读了解如何以极低配置成本让网站内容对 AI 代理可搜索,无需自建检索基础设施。

掌握 Search for Agents 的自动发现机制(HTML meta 标签与 Markdown front matter)和搜索端点用法。

关键洞察
  1. Search for Agents 将 AI Search 实例的创建、内容索引和搜索端点暴露全部自动化,只需在 Cloudflare 仪表盘开启开关。
  2. 服务自动在网站每个页面的 HTML head 中添加 agent:instructions、agent:endpoint 等元数据,若启用 Markdown for Agents 则通过 YAML front matter 提供相同信息,方便代理发现搜索 API。
  3. 搜索端点返回 Markdown 格式的检索内容而非生成答案,代理可利用自身 AI 模型处理结果。
转成行动

深入阅读

正文与原文对照

原文保真覆盖:全文原文字符:12032

AI Search 是我们的服务,它索引你的内容,让你无需构建完整的检索基础设施就能为任何应用或代理添加搜索功能。该服务现已支持将你的网站作为数据源,自动抓取、转换并索引其页面。

不过,为你的网站设置 AI Search 实例最初需要手动创建和配置,然后完成所有集成工作,以便从你的域名提供搜索端点,并确保代理知道在哪里找到索引以及如何使用它。

今天,我们推出 Search for Agents,它将这一设置简化为 Cloudflare 仪表板中的一个开关。为你的区域开启它,我们的服务将创建你的 AI Search 实例,开始索引你的内容,并使搜索可从你自己的域名被发现和访问。

工作原理

这一想法自然源自 Markdown for Agents,其中 Cloudflare 的网络使用内容协商头为启用的区域实时将任何 HTML 页面转换为 Markdown。类似地,Search for Agents 利用 AI Search 的能力,自动为你的区域创建索引,并暴露任何 AI 代理都可以发现和使用的 API 来搜索你的网站,且在你的域名下,所有这些都在网络层面完成。

你可以使用 API 启用 Search for Agents,或前往区域页面中的仪表板,在快速操作下启用:

在仪表板中启用 Search for Agents

Search for Agents 面向所有客户提供,包括免费版(有限制)。启用后,Cloudflare 将自动创建 AI Search 实例,开始抓取并索引你区域中的内容。请参阅我们的开发者文档了解抓取过程如何工作。

你可以直接从此页面访问你的实例,或直接前往你账户的AI > AI Search 实例视图:

Search for Agents AI Search 实例

你区域的 AI Search 实例使用默认设置创建,但你可以随时启用重排序或更改缓存设置等配置选项。请参阅我们的文档获取完整选项列表。

一旦 AI Search 索引了你的内容,你或互联网上的任何代理都可以开始使用 Search for Agents,但需遵守你的域名设置(例如你的机器人管理设置、AI Crawl Control 和 Web 应用防火墙(WAF)配置)。

可发现性

如果代理不知道搜索的存在,搜索就没什么用。为了促进可发现性,Search for Agents 会自动在你网站的每个页面上公布搜索端点。

例如,对于 HTML 响应,我们在页面的 <head> 中添加元数据:

<meta name="agent:instructions" content="Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown.">
<meta name="agent:endpoint" content="https://developers.cloudflare.com/.well-known/search?q={query}">
<meta name="agent:method" content="GET">
<meta name="agent:documentation" content="https://developers.cloudflare.com/ai-search/how-to/search-for-agents/">

如果你还启用了 Markdown for Agents,使用 Accept: text/markdown 请求页面的代理会在 YAML front matter 中收到相同的信息:

---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://developers.cloudflare.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

代理将轻松获取这些指令,并知道接下来如何搜索你的网站。

搜索内容

一旦代理知道你的网站有搜索端点,它就可以开始使用它:

$ curl "https://developers.cloudflare.com/.well-known/search?q=cloudflare+artifacts"
# Search results for: "cloudflare artifacts"

## docs/artifacts/api/workers-binding/index.md (score: 1.000)

# Workers binding · Artifacts · Cloudflare Artifacts docs

Call Artifacts from a Worker binding.

---

## docs/artifacts/index.md (score: 0.951)

# Artifacts · Cloudflare Artifacts docs

Store, version, and share filesystem artifacts across Workers, APIs, and Git-compatible tools.
...

根据你的 AI Search 配置,代理还可以使用自然语言向搜索端点提问:

$ curl --get "https://developers.cloudflare.com/.well-known/search" --data-urlencode "q=What is the maximum push size for Cloudflare Artifacts?"
# Search results for: "What is the maximum push size for Cloudflare Artifacts?"

## docs/artifacts/platform/limits/index.limits-cloudflare-artifacts-docs.md (score: 1.000)

# Limits · Cloudflare Artifacts docs
Section: Limits · Cloudflare Artifacts docs

title: Limits
description: Review Artifacts platform limits.
pcx_content_type: reference
products:
  - artifacts

Limits that apply to creating, importing, cloning, and pushing Artifacts are detailed below.

These limits cover naming rules, storage, request rates for control-plane and Git operations, and the size of each push.

FeatureLimitControl-plane request rate2,000 requests per 10 seconds per Artifacts namespaceGit request rate, per artifact2,000 requests per 10 seconds per artifactMaximum storage per repository1 GB for repos created on or after 2026-09-29. Repos created earlier have a 10 GB limit. See size limit change.Maximum storage per account1 TB (can be raised on request)Maximum number of repositoriesUnlimitedMaximum number of namespacesUnlimitedNamespace name length2–63 charactersNamespace and repo namesStart with a letter or digit. Remaining characters may include letters, digits, ., _, and -.Maximum push size64 MiB per push. Includes all data sent in the push. Split larger work into several smaller pushes.Maximum objects per push50,000 objects, such as file versions, folders, and commits.Maximum file size32 MiB per file. Already-compressed files, like images, video, or zip archives, may be rejected slightly below 32 MiB.Maximum ref updates per push1 MiB of branch and tag updates per push.Maximum entries per folder100,000 files and subfolders in a single folder.
...

请注意,此搜索端点返回的是检索到的内容(Markdown 格式),而不是生成的答案。代理已经拥有 AI 模型并与用户进行对话;它所需要的只是你网站上的相关信息,而不是另一个 AI 模型试图代表它回答。

支持新的 HTTP 方法:QUERY

新的 HTTP QUERY 方法是 IETF 提案标准,由我们自己的 James Snell 参与合著,于 2026 年 6 月作为 RFC 10008 发布。QUERY 允许客户端在请求体中安全且幂等地发送搜索条件,而无需修改服务器状态。这使其非常适合 AI 搜索。

QUERY 的采用正在进行中,主要浏览器厂商正在讨论该 RFC,多个框架和客户端要么已经采用(例如 curl 和 undici),要么正在讨论采用。

Search for Agents 原生支持 QUERY,可以使用纯文本或 JSON 请求体:

# Plain text
curl -X QUERY 'https://developers.cloudflare.com/.well-known/search' \
  --data 'What is the maximum payload size per ingestion request in Basin Pipelines?'

# JSON
curl -X QUERY 'https://developers.cloudflare.com/.well-known/search' \
  --header 'Content-Type: application/json' \
  --data '{"q":"How many bulk import requests per minute does Email Service allow?"}'

实际效果

让我们在代理会话中看看实际效果。我们的开发者文档已启用 Search for Agents。当我们打开 OpenCode 会话并询问“Cloudflare Artifacts 的最大推送大小是多少?”时,在日志中我们可以看到代理在主页上发现搜索端点,然后使用该问题获取 /.well-known/search 以获取搜索结果。

一个 Search for Agents 请求

几秒钟后返回答案,并且是正确的。

OpenCode 在使用 Search for Agents 时获得答案

一旦代理发现搜索 API,它很可能会在同一会话中多次重用它,每当需要搜索同一网站的内容时。

在此公告之前,我们为开发者文档启用了 Search for Agents,我们发现代理在发现搜索 API 并在任务中使用它方面做得很好。

我们开发者文档中 Search for Agents 请求的示例

它仍然是一个 AI Search 实例

因为 Search for Agents 由你账户中的 AI Search 实例提供支持,所以你也能获得所有标准配置选项和功能。例如,你可以启用公共 REST API 或 MCP 端点,或从 Workers 中使用它,甚至可以将 AI Search 嵌入到你的网站供人类访客使用。

嵌入在 Cloudflare 博客中的 AI Search 片段

开始使用 Search for Agents

从今天开始,Search for Agents 面向所有客户提供。使用遵循 AI Search 定价;这包括摄取内容、存储索引内容和提供查询服务,受账户在 Workers 免费版和付费版中的包含用量和限制约束。

我们还建议你查看我们的 Agent Readiness 页面(见 公告),了解如何让你的站点针对智能体进行优化,从指导智能体如何进行身份验证,到控制智能体可以看到哪些内容、以何种格式接收内容,以及如何为其付费。

Search for Agents 的 Agent Readiness 检查

查看 Search for Agents 开发者文档以了解更多信息。在 X 上关注我们,或来 Cloudflare Developer Discord 与我们交流。我们希望听到那些让自己的内容可被智能体搜索的站点所有者的声音。