Cloudflare Search for Agents Tutorial: How to Make Your Website Support AI Agent Search?

Summary: On a domain you control that’s already connected to Cloudflare, enable Cloudflare Search for Agents, wait for crawling and indexing to finish, then validate with the site endpoint /.well-known/search so AI Agents can retrieve your public content through a standard address.

Bottom line first: Cloudflare Search for Agents entered a Beta available on all plans on November 25, 2026. As long as the domain is onboarded to your own Cloudflare account, you don’t need to build a separate search backend. Turn on the toggle in Quick Actions on the domain Overview, and Cloudflare automatically creates a hosted AI Search instance and generates the site endpoint https://your-domain/.well-known/search. Turning the toggle on only means the configuration has been submitted; whether content can actually be found depends on subsequent crawling and indexing. To judge whether it’s done, look at the Jobs task status and whether a set of pre-designed queries returns the expected pages.

Three key conditions affect this conclusion:

  • The domain must already be onboarded to a Cloudflare account you’re authorized to manage.
  • The content being indexed should be pages you already intend to make public.
  • Your robots.txt, Content Signals, WAF, and AI Crawl Control rules must not block crawling or querying.

A note on sources and scope: Content marked [Official] in this article comes from Cloudflare’s official documentation and changelog, with sources current as of 2026-11-27 (UTC). Commands and code marked [Author example] are acceptance-test templates built from official parameters; addresses are placeholders. Sections marked [Hypothetical example] are assumed scenarios. This article does not draw on community experience and contains no hands-on measurement data; you’ll need to verify any assessment of effectiveness on your own site.

cloudflare-search-for-agents-tutorial-en-image-0


Knowledge Map: Cloudflare Search for Agents, from Enablement to Acceptance

cloudflare-search-for-agents-tutorial-en-image-1

Figure notes: the whole main line is “prepare → enable → wait for the index → verify”. When verification fails, don’t just widen the crawl scope — go back to the matching step based on the symptom. Endpoint not responding? Return to section 1 and check the access rules. Expected entries missing? Return to section 3 and check the crawl and filtering configuration. Content stale? Section 3 again — double-check sync and cache timing.

Index: Reading Order for the Cloudflare Search for Agents Tutorial

I recommend reading in numbered order — each section’s output becomes the input for the next one:

  1. Section 1: Prepare — pin down the authorized sites and the public-facing boundaries; every configuration that follows stays within that scope.
  2. Section 2: Enable in the Console — create the instance and the site endpoint, and get familiar with the default settings.
  3. Section 3: Inspect the Index — wait for crawling to finish, then adjust path filters, Chinese tokenization, and sync strategy as needed.
  4. Section 4: Verify the Endpoint — validate with a fixed question set and wire up a sample Agent.
  5. Section 5: Troubleshooting — consult only when verification fails; diagnose by symptom.

By the end, you’ll have a site endpoint that Agents can query, plus an acceptance record you can reuse.

To Know: Cloudflare Search for Agents Terminology

Term Brief Explanation
AI Search instance A Cloudflare-hosted retrieval instance. Created automatically when you enable the feature, named search-for-agents-<ZONE_ID>
Site endpoint The /.well-known/search path under your domain, where Agents send retrieval requests
Discover mode A crawl method that starts from entry pages and sitemaps and follows links to discover pages
Jobs The task page inside an instance, used to check the status and history of crawl and sync jobs
Hybrid retrieval A retrieval method that combines semantic matching with exact keyword matching
Content Signals Signals declaring what purposes a site’s content may be used for, such as search and ai-input
Trigram tokenization Keyword tokenization that splits text into three-character chunks, well suited to Chinese, Japanese, and Korean

1 Preparing Before Enabling Cloudflare Search for Agents

1.1 Confirm Domain Control and Onboarding Status

[Official] Search for Agents operates on domains that are already connected to your own Cloudflare account. If your domain isn’t connected yet, you’ll need to follow the official domain guide to complete onboarding first. When you go with full DNS onboarding for the first time, check the DNS records and update the name servers — the record contents should match your existing deployment. For sites that are already connected, you can start right from the domain dashboard.

This tutorial only applies to websites you have the right to maintain. Every example.com in the examples needs to be replaced with your own domain — don’t run test requests against someone else’s site.

1.2 Define the Public Scope of Cloudflare Search for Agents

Once the feature is enabled, your site content gets built into a queryable index, so you need to figure out up front “which pages should Agents be able to find.” A safer approach is to pilot with a small batch of already-public help documentation. That way you know exactly what should be matched, and the first round of acceptance testing stays small too.

Member pages, shopping sessions, pre-release content, and pages containing account information must be protected by real access controls — you can’t count on “if it isn’t linked, it won’t get crawled.” [Official] The existing AI Crawl Control and Web Application Firewall rules will continue to apply to search endpoint requests. Configuring the index scope and restricting access are two separate things, and you need to verify each one on its own.


2 Enabling Cloudflare Search for Agents in the Console

2.1 Steps to Enable Cloudflare Search for Agents

[Official] The console path is as follows:

  1. In the Cloudflare console, select your domain, go to Overview, and open Search for Agents under Quick Actions.
  2. Review the default settings and pricing notice, then confirm. For actual pricing, refer to the console notice and the official pricing page — this article doesn’t list specific numbers.
  3. Cloudflare creates an instance named search-for-agents-<ZONE_ID> in your account’s default namespace, with the domain’s HTTPS address as the data source.
  4. Reach the instance from the domain Overview or from AI Search in your account, and check job status and history under Jobs.

Turning the toggle on only means the configuration was submitted successfully. Wait until crawl and index processing finishes before doing your first verification — otherwise it’s normal that searches return nothing.

2.2 Cloudflare Search for Agents Default Settings at a Glance

Setting Default (official docs) What it means for a help site
Crawl method Discover mode; URLs are found from entry pages and sitemaps, sitemap optional Links visible on the homepage, public directories, and sitemaps are the entry points you control
Link depth Up to five hops from the starting point Deeply nested articles need sitemaps or directory pages to add entry points
Subdomains Not included by default Content on subdomains such as docs. needs to be checked separately
Page limit Defaults to 100,000 pages, still subject to plan and instance limits Workers Free caps daily crawling at 500 pages
Retrieval method Hybrid retrieval Matches both conversational phrasing and exact terminology
Returned chunks Up to ten The agent gets chunks, not the whole site
Reranking and query rewriting Off initially You can evaluate turning them on in Settings as needed

If your site actually lives on a different hostname, check the data source address, the hostname after redirects, and the subdomain configuration first. The brand domain may look the same while the crawl scope doesn’t line up — this kind of problem is easy to miss.

2.3 Which Cloudflare Search for Agents Settings You Can Change

[Official] In the instance’s Settings, options such as the data source and embedding model are fixed once created, while crawl configuration, caching, and ranking-related settings can be adjusted. Note in particular that changing Discover crawl parameters in the console and saving triggers a full reindex of the entire instance. It’s best to do this during off-peak hours and leave time for the background jobs.


3 Tracking indexing progress in Cloudflare Search for Agents

3.1 Using Jobs to determine whether indexing is ready

Jobs are the only reliable signal for deciding whether you can start validating. Before a job completes, empty or incomplete query results are expected behavior. Once the job finishes, open the log for an individual entry to confirm that key pages have been crawled and that their body content can be extracted normally.

3.2 Narrowing the Public Scope with Path Filters

[Official] Path filtering supports both include and exclude modes, and exclude rules take precedence. Patterns are case-sensitive: a single asterisk * matches only a path segment at the same level, while a double asterisk ** can cross slashes.

[Example] Say all your public help articles live under the /help/ directory. You can start by expressing the public scope with the include pattern /help/**. Then use exclude patterns to drop pages that are already public but don’t work well as Q&A material — for instance archived drafts under /help/archive/** and tag pages under /help/tags/*. Before testing, double-check the actual URL casing, directory depth, and trailing slashes, then look at the Jobs to see which records were skipped by the rules.

If a page does get crawled but keywords still can’t find it, pick one entry and inspect the extracted body text to confirm the navigation bar or boilerplate isn’t burying the heading, steps, and conditions. For sites with a consistent body structure, you can also consider using a content selector to narrow the indexing target down to the main content area.

3.3 Evaluating trigram Tokenization for Chinese Sites

[Official] In its changelog entry dated October 16, 2026, Cloudflare announced that keyword search can use trigram tokenization to handle full questions in Chinese, Japanese, and Korean. If English model names already match but pure Chinese keywords perform poorly, first check the current keyword tokenization setting in your instance, then follow the docs to evaluate switching to trigram. After the change, you’ll need to wait for a full rebuild.

It’s worth comparing results before and after the change using the same batch of Chinese keywords, natural-language questions, and alphanumeric error codes. This improvement targets term matching — it shouldn’t be mistaken for an upgrade to generation capabilities.

3.4 Cloudflare Search for Agents Sync and Cache Timing

Mechanism Default interval (official docs) What it affects
Discover crawl cache 24 hours How often source pages are re-crawled
Scheduled sync Every 24 hours How often the background sync job starts
Query similarity cache 48 hours How long similar queries reuse old results
Auto-pause after inactivity 31 consecutive days with no search requests Pauses scheduled sync; the existing index is still queryable

[Official] If an instance connected to an external data source receives no search requests for 31 consecutive days, it automatically pauses scheduled sync. During the pause, newly published content won’t enter the index. Once the instance receives search or chat requests again, sync resumes during the activity check, and admins can also manually resume it from the console. Low-traffic personal sites should pay extra attention to this. After publishing important updates, an admin can manually trigger a sync.

cloudflare-search-for-agents-tutorial-en-image-2

We recommend recording the source page update time, sync completion time, query time, and the source version that matched in the acceptance log. If you see stale content again, you can trace it item by item along this chain instead of drawing conclusions from a single search result.


4. Verify the Cloudflare Search for Agents Site Endpoint

4.1 A Minimal Check with curl

[Author’s example] The commands below are built from the official GET and QUERY parameters. The domain and the questions are placeholders — swap in content from your own public pages:

# 1. Precise lookup with a distinctive phrase; --include lets you see the HTTP status
curl --get --include 'https://example.com/.well-known/search' \
  --data-urlencode 'q=设备配对失败 M104'

# 2. The same content, phrased as a casual question
curl --get 'https://example.com/.well-known/search' \
  --data-urlencode 'q=新设备一直连不上账号,我可以怎么排查?'

# 3. QUERY method + JSON input (only the input encoding changes)
curl --request QUERY 'https://example.com/.well-known/search' \
  --header 'Content-Type: application/json' \
  --data '{"q":"设备配对失败 M104"}'

[Official] By default, the endpoint returns the relevant content as Markdown, optionally along with source citations and relevance scores. The query goes through the public site endpoint, so adding a Cloudflare management API token to the command is not needed and not advisable. When you validate, open the original pages that matched by hand and check them, so you can tell “found a relevant snippet” apart from “there’s enough evidence to answer the question.”

4.2 Check the Agent search discovery metadata

[Official] An Agent needs to know up front that your site supports search. Open the HTML returned by the public page and check whether the Agent search discovery information in the document head points to the site’s search path. If Markdown for Agents is also enabled, you can send the same page request with Accept: text/markdown and inspect the YAML front matter.

curl -s -H 'Accept: text/markdown' 'https://example.com/help/pairing' | head -n 20

Metadata showing up doesn’t mean the crawl queue has finished. It’s worth recording “metadata visible” and “search hit” as two separate acceptance conclusions, so you can tell whether the problem lies in access, discovery, or indexing.

4.3 Designing acceptance samples for Cloudflare Search for Agents

[Worked example] Here’s a small sample set the author designed — after every change to crawl or ranking configuration, re-test with the same set of questions:

No. Sample type Query method Expected result
A Help article with a full error code Exact phrase, e.g. the error code Source points to that article
B Installation instructions Conversational description Source points to the installation page
C A recently updated public release note A term unique to the new version Hits the new version’s content
D A path that shouldn’t be public (negative case) Don’t run a query; just check the backend records Jobs show it as skipped or excluded

For negative case D, verify the scope only through the backend index records — don’t use sensitive content as a query term. Whether an external Agent can call it can only be confirmed at the level of “the interface is available to clients that have the capability to call it and meet the access conditions.”

4.4 Connecting Cloudflare Search for Agents to Your Agent

The site endpoint returns search snippets, but actually answering a question still needs a Large Language Model. [Author example] The code below first queries your site endpoint, then hands the returned Markdown snippets to the model, asking it to answer only from those snippets and cite the sources. Model invocation goes through the OpenAI-compatible interface; the code hasn’t been tested live, and you can swap the model name for any other model the platform supports:

import requests
import openai

SITE = "https://example.com"  # Replace with the domain you have admin rights to
client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.apiyi.com/v1"  # APIYI OpenAI-compatible endpoint
)

q = "新设备一直连不上账号,我可以怎么排查?"
ctx = requests.get(f"{SITE}/.well-known/search", params={"q": q}, timeout=15).text

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "只依据给定片段回答,并注明来源;片段不足时直说。"},
        {"role": "user", "content": f"片段:\n{ctx}\n\n问题:{q}"}
    ]
)
print(resp.choices[0].message.content)
View the full implementation (including acceptance logs)
import json
import time
import requests
import openai

SITE = "https://example.com"  # Replace with the domain you have admin rights to
MODEL = "gpt-4o-mini"         # Can be swapped for another model the platform supports

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.apiyi.com/v1"  # APIYI OpenAI-compatible endpoint
)

SYSTEM = (
    "你是站点帮助助手。只依据用户提供的检索片段回答,"
    "回答末尾列出引用的来源地址。片段不足以回答时,明确说明无法确认。"
)


def site_search(q: str) -> tuple[int, str]:
    """Call the Cloudflare Search for Agents site endpoint and return the status code and Markdown body"""
    r = requests.get(f"{SITE}/.well-known/search", params={"q": q}, timeout=15)
    return r.status_code, r.text


def answer(q: str) -> dict:
    status, ctx = site_search(q)
    record = {"query": q, "query_time": time.strftime("%Y-%m-%d %H:%M:%S"),
              "http_status": status}

    if status != 200 or not ctx.strip():
        record["result"] = "端点无响应或无片段,请对照第 5 节排查"
        return record

    resp = client.chat.completions.create(
        model=MODEL,
        messages=[
            {"role": "system", "content": SYSTEM},
            {"role": "user", "content": f"检索片段:\n{ctx}\n\n问题:{q}"},
        ],
        max_tokens=800,
    )
    record["context_preview"] = ctx[:300]
    record["answer"] = resp.choices[0].message.content
    return record


if __name__ == "__main__":
    # Keep in sync with the 4.3 acceptance samples; rerun after every config change
    for q in ["设备配对失败 M104", "新设备一直连不上账号,我可以怎么排查?"]:
        print(json.dumps(answer(q), ensure_ascii=False, indent=2))

Tip: When validating the whole “retrieval + answer” pipeline, you can grab free trial credits through APIYI at apiyi.com. A single API key lets you switch between OpenAI, Claude, Gemini and other models, so it’s easy to compare how each of them handles instructions like “answer only from the snippets.”

cloudflare-search-for-agents-tutorial-en-image-3

5 Troubleshooting Common Cloudflare Search for Agents Issues

5.1 Diagnose by Symptom, Don’t Just Widen the Crawl Scope

Symptom Check first (per official docs) Back to step
Endpoint doesn’t respond as expected HTTP status, hostname, path, parameters, and the domain’s own access rules; the site endpoint is independent of the optional public REST and MCP interfaces and doesn’t need to be enabled separately 1.2
Response arrives but expected entries are missing Jobs and item logs, path filters, subdomains, crawl depth and limits, whether the body text is extractable 3.1, 3.2
Blocked by robots The crawler identifies as Cloudflare-AI-Search, and blocked_by_robots_txt appears in the logs 1.2
Rejected by Content Signals The crawler declares two purposes, search and ai-input; setting either one to no rejects the crawl 1.2
Content is stale or mixed with navigation Crawl cache, sync interval, similarity cache, and content selectors 3.2, 3.4

When you’re dealing with access policy issues, adjust the rules for explicitly authorized visitors instead of disabling protection for the entire site. If the paths you plan to make public conflict with your content policy, keep the existing policy and re-check which paths are actually suitable for public exposure.

5.2 Passing Criteria for a Cloudflare Search for Agents Acceptance Check

Once all three queries A, B, and C from 4.3 return the expected sources, counter-example D is confirmed as excluded in the backend records, and the discovery metadata is visible, you can consider the site ready for AI Agent search. From then on, every configuration change should trigger a rerun of the same sample set, with the results and timestamps written into your acceptance log.


FAQ

Q1: What is Cloudflare Search for Agents?

It’s a site search feature Cloudflare built on top of AI Search. Once you turn it on for a domain, it automatically crawls and indexes your public pages, then returns sourced Markdown snippets to AI agents through the `/.well-known/search` endpoint.

Q2: Can I use Cloudflare Search for Agents right now?

[Official] As of November 25, 2026, it’s available in Beta to all plans. Since it’s still in Beta, the defaults and limits may change — check the official docs before you do anything.

Q3: Can I enable Cloudflare Search for Agents for someone else’s website?

No. It only works on domains connected to your own Cloudflare account. Every example in this article should be run on a site you have admin rights over.

Q4: Why can’t I find any content even after turning the switch on?

Turning the switch on only means the configuration has been submitted — crawling and indexing take time. Check the job status under Jobs and verify once it’s finished. If entries are still missing, use the table in 5.1 to check your filtering rules, robots, and Content Signals.

Q5: How do I get my own agent to answer questions directly from the retrieval results?

You can call the site endpoint first to get snippets, then hand them to a Large Language Model to generate an answer with sources — see the sample code in 4.4. For the model API, you can use the OpenAI-compatible endpoint from APIYI apiyi.com. New users get free trial credits, which makes it a good way to get the whole pipeline working first.

Q6: What’s the easiest way to compare how different models answer?

Keep the same set of retrieval snippets and the same question, and only swap the `model` parameter. With APIYI apiyi.com you can call several models using one key, then just compare two things: “does it stick strictly to the snippets” and “does it cite its sources.” Note that this is your own test — this article doesn’t provide comparison data.

Q7: What are the known limitations of Cloudflare Search for Agents?

[Official] Subdomains aren’t included by default, links are followed at most five hops, Workers Free caps crawling at 500 pages per day, and each request returns at most ten snippets. Data sources and embedding models can’t be modified after creation, and changing the Discover parameters triggers a full rebuild. Regular sync also pauses after 31 consecutive days with no queries.


Leave a Comment