Repository navigation
Conversation
GET /.well-known/search?q=... returns the most relevant blog posts as
markdown, so agents can search the site instead of crawling it. QUERY is
also accepted, with a plain-text or JSON {"q": "..."} body.
- Responses are text/markdown, start with # Search results for: "<query>"
and send Accept-Query. Each result has its URL, its .md URL, date, tags,
reading time and summary, ranked by the existing Lucene blog search.
- Errors are markdown too: 400 for a missing or overlong query, and 503
with Retry-After if the search index isn't available.
- Every HTML page advertises the endpoint with agent:instructions,
agent:endpoint, agent:method and agent:documentation meta tags, and the
markdown version of every page repeats them in an agent: front-matter
block.
- Markdown output now always uses \n line endings, whatever the host OS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checks the endpoint returns markdown results, a missing query returns a markdown error, and pages advertise the endpoint in their meta tags and front matter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| catch (Exception ex) when (ex is not OperationCanceledException) | ||
| { | ||
| // Most likely the Lucene index is missing or still being built. | ||
| _logger.LogError(ex, "Agent search failed for query {Query}", query); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a site search endpoint for AI agents, following the isitagentready "Search for Agents" check and Cloudflare's Search for Agents contract.
The endpoint
GET /.well-known/search?q=…returns the most relevant blog posts astext/markdown. An optionallimit(1–20, default 10) sets the number of results.# Search results for: "<query>", and the response sendsAccept-Query: text/plain, application/json.QUERYis also accepted, with the query as a plain-text body or JSON{"q": "…"}. That's whatAccept-Queryadvertises..mdURL, publish date, tags, reading time and summary. Ranking reuses the existing Lucene blog search, so it matches the ⌘K search.400for a missing or overlong query,413for a body over 8 KB, and503withRetry-After: 60if the search index isn't available.Advertising it
<meta name="agent:instructions|endpoint|method|documentation">tags in<head>.agent:front-matter block. The converter reads them from the page's meta tags, so the layout is the only place they're defined.Other changes
\nline endings. It used to mix in\r\nwhen the host ran Windows.Testing
SearchForAgentsTestssmoke tests run after each deploy. All 4 pass locally, and all 4 fail against current production, which confirms they detect the feature missing..mdand through theAcceptheader, now with theagent:front matter, and every HTML page has the 4 meta tags.limitvalues that are invalid or out of range, a 600-character query, a 20 KBQUERYbody, and quotes in the query.SpeakingPage_DisplaysSpeakingEngagements, which needs talks the local database doesn't have.After deploying, check the post-deploy E2E run, then run the isitagentready scan.
🤖 Generated with Claude Code