Skip to content

Topic: API

The manual is the API

A coding agent, a support chatbot, and a RAG pipeline all need a reliable way to find and fetch relevant content from a documentation site, without scraping HTML or guessing URLs. How one documentation manual turns its existing corpus into that interface, without building a second system for it.

Olivier Carrère10 min read

View as Markdown
On this page

When a coding agent needs to follow your docs

Maya is a backend developer joining a team that maintains MercuryFlow, an imaginary platform for managing payment-processing services.

On her first week, she’s asked to add automatic retry handling to a MercuryFlow payment worker.

She asks her coding agent:

How do I configure retries for a MercuryFlow worker?

The agent already has access to the MercuryFlow source repository, so it could search the code directly: the retry implementation, the configuration structs, the defaults, the tests. But that’s not what Maya asked. She wants the supported procedure for configuring retries, not the implementation.

That distinction matters. Source code tells an agent what the software does. Documentation tells it how developers are expected to use it: which configuration method is supported, what prerequisites apply, what order to follow, and what limitations or warnings matter along the way. Not every consumer even has repo access to begin with: a support chatbot, an external developer assistant, or a RAG pipeline may only ever see the published documentation, never MercuryFlow’s private codebase.

So, for this question, the agent needs to do five things:

  1. Discover what documentation exists.
  2. Identify which of it is procedural rather than conceptual.
  3. Find the specific procedure that matches the question.
  4. Retrieve the actual text.
  5. Follow it.

None of that is exotic. It’s what any new contributor does by hand on their first day.

The trouble is doing it against a normal documentation website. HTML is built for a browser and a person scrolling it, not for a program deciding what to fetch next. A crawler has to:

  1. Walk the navigation menu.
  2. Guess which URLs are likely to hold a procedure rather than a glossary entry.
  3. Open pages just to find out what kind of content is on them.

For a small site, that may be acceptable. For a documentation corpus with hundreds of pages, the agent can spend a meaningful share of its context budget scraping before it reaches an answer, the context-window equivalent of reading the whole employee handbook to find the Wi-Fi password. One common failure mode is simpler: rather than pay that cost, the agent skips the docs and answers from general knowledge instead of the project’s actual, current procedure.

MercuryFlow’s documentation can offer a different interface. Instead of crawling, the agent asks the documentation site directly:

  1. What it has.
  2. How that content is classified.
  3. Where to retrieve it.

It first discovers the documentation contract:

GET /schema.json

The schema tells it that the corpus distinguishes concept, task, and reference content, and that those values can be used when querying the index.

The agent needs a procedure, so it asks for tasks:

GET /en/index.json?contentType=task

Among the results it finds:

{
  "title": "Configure retry policies",
  "url": "/en/guides/configure-retry-policies/",
  "markdown": "/en/guides/configure-retry-policies.md",
  "contentType": "task",
  "pageType": "topic"
}

It follows the markdown URL and retrieves the procedure itself, without the navigation, footer, or client-side presentation that surround the human-facing page.

Payment Retry Logic Flow Diagram

Yes

No

Yes

No

MercuryFlow payment worker

Attempt payment

Payment succeeds?

Complete payment

Retries remaining?

Apply retry policy

Wait before retry

Mark payment as failed

Figure 1 — Automatic retry handling: the worker retries failed payment attempts according to a configured retry policy before marking the payment as failed.

The agent can now give Maya the documented procedure instead of reconstructing one from the site’s HTML.

Agent Procedural Execution Diagram

Developer asks: How do I configure retries?

Coding agent

Discover documentation

Filter for procedural content

Retrieve Markdown

Follow the documented procedure

Figure 2 — Procedure retrieval flow: a coding agent answers a how-to question by discovering, filtering, and retrieving, not by crawling.

The example is imaginary, but the mechanism is not. It rests on three simple outputs from the documentation corpus.

What the agent actually finds: schema, index, Markdown

That whole workflow rests on three things, used in order.

EndpointRoleWhat it provides
/schema.jsonDiscovery stepTells a consumer what’s queryable before it fetches anything else: which content types and page types exist, and which query parameters are supported. An agent reads it once and knows how to ask for what it wants, instead of hard-coding assumptions about the site’s structure.
/en/index.jsonCorpus indexA machine-readable listing of the documentation corpus, with title, URL, and a markdown property pointing at that document’s clean text mirror. Accepts the parameters that schema.json advertises, so a request such as ?contentType=task filters it down to procedural entries instead of returning the whole corpus.
/llms.txtLighter entry pointThe same corpus as a short table of contents, following the community llms.txt convention. A lighter starting point than the full index.

The Markdown mirror is the payload: following the markdown URL from an index entry returns the same content a human reader would see, without the navigation bar, the footer, or any client-side script.

Agent Discovery Stack Diagram

schema.json

index.json

Markdown article

Figure 3 — Discovery stack: schema, index, and Markdown endpoints providing structured retrieval for AI agents.

This is the same mechanism the coding agent used above. It isn’t a separate “AI API” bolted onto the site. It’s the ordinary build output, queried directly instead of rendered into a page first.

The same source: chatbots and RAG pipelines

Maya’s coding agent is only one possible consumer.

Imagine that MercuryFlow also has a support chatbot. A user asks:

How do I configure retries for a MercuryFlow worker?

The chatbot doesn’t need the whole documentation corpus in its context window, and it doesn’t need to guess which pages might be relevant by crawling links. It:

  1. Identifies the content type it wants (a task or a reference entry, not a blog-style concept piece).
  2. Queries the index for matching entries.
  3. Fetches the Markdown for the best match.
  4. Uses that text directly as grounding for its answer.
Chatbot and RAG Pipeline Diagram

Application

Query documentation index

Retrieve matching Markdown

Use content as context

Answer / generate

Figure 4 — Retrieval-augmented generation pipeline: structured index queries ground answers in exact documentation.

A retrieval-augmented generation pipeline can use the same discovery mechanism when ingesting documentation, before it ever handles a user query. A common way to ingest documentation from a website is to crawl and extract its rendered pages. Publishing a queryable index and Markdown mirrors offers another path:

  1. Read /schema.json to see what’s there.
  2. Read /en/index.json for the full document list with retrieval URLs already attached.
  3. Fetch each .md file directly instead of parsing rendered HTML.

That’s one useful way to build the ingestion step, not the only valid RAG architecture. Plenty of systems will keep scraping HTML or ingesting a raw Git checkout instead. Nothing about the documentation interface requires a vector database either. What comes after retrieval, embedding, indexing, prompting, is a decision the consuming application makes on its own.

An agent scoped to procedures only

The more interesting consequence of that taxonomy shows up when a consumer wants to exclude content, not just find it.

Suppose Maya’s coding agent is configured specifically to help developers perform MercuryFlow procedures, nothing else. Conceptual background and reference tables just spend its context budget on content it won’t act on.

contentType valueReturns
taskOnly procedural entries.
conceptOnly conceptual background entries.
referenceOnly reference entries.

The agent, or the person configuring it, picks the value that matches what the agent is actually for.

Procedure-Scoped Agent Architecture Diagram

Documentation corpus

contentType

task

concept / reference

Procedure-only agent

Figure 5 — Procedure-scoped agent retrieval: taxonomy filters scope retrieval directly to procedural tasks.

The documentation taxonomy becomes a selection interface for machines.

That matters because the taxonomy does double duty rather than existing twice:

  • Humans use contentType to navigate, to tell a how-to apart from background reading before they start clicking.
  • Machines use the same field to constrain retrieval before they start fetching.

There’s no separate machine-facing taxonomy sitting next to the human-facing one. It’s one set of values, read by two kinds of readers.

A guide from a slice of the corpus

This also means filtering scales up from one document to a whole guide.

Imagine MercuryFlow has a 500-page documentation set and someone asks:

Create a guide containing only installation procedures.

Against unstructured HTML, that means opening a large fraction of the site to work out which pages qualify. Against the index, it’s one filtered query, pageType=topic combined with contentType=task, narrowed further by title or keyword matching if the installation procedures aren’t already grouped together.

The result is a list of Markdown URLs. A consuming agent could then fetch those URLs and assemble them into a new document, without ever needing to understand how the site’s navigation or URL structure works.

The same interface, from inside an editor

Nothing in this workflow is specific to a chatbot or an agent framework either.

Imagine Maya is working in an IDE plugin that understands MercuryFlow documentation. When she asks:

How do I use this feature?

the plugin can:

  1. Query the documentation index.
  2. Retrieve the matching Markdown.
  3. Display it inline next to the code she is writing.

It’s the same HTTP, JSON, and Markdown interface as the coding agent and the chatbot above, just called from a different application.

One corpus, many consumers

Put Maya’s coding agent, the MercuryFlow support chatbot, the RAG pipeline, and the IDE plugin side by side.

None of them depend on which product is asking. They all speak the same discovery contract and read the same Markdown documents.

Documentation Corpus Consumers Diagram

Documentation

schema.json + index.json

Markdown documents

Coding agent

Chatbot

RAG pipeline

IDE plugin

Figure 6 — Multi-consumer documentation architecture: one discovery contract and Markdown corpus serving humans, chatbots, coding agents, and RAG pipelines.

The point isn’t the list of possible consumers. It’s that they can all consume the same documentation corpus instead of requiring separate AI-specific documentation.

A discovery contract instead of a crawler

A conventional crawler’s question is: which links should I follow?

robots.txt can tell it which paths it’s allowed to visit, but not what those paths contain or how to ask for a subset of them. It still has to open pages and infer structure from whatever HTML happens to be there.

A documentation site with a discovery contract answers a different question up front:

  1. Here is what this documentation provides.
  2. Here is how it’s classified.
  3. Here is where each document can be retrieved.

The crawler’s inference step disappears, because the answer was already published as data.

Still, that doesn’t make the site an API in the formal sense. There’s no authentication, no write operations, nothing beyond static files served over HTTP. What it does do is make the site closer to a documentation discovery interface than a plain collection of HTML pages.

The architecture underneath

All of the use cases above run on the same build output.

Manual as API Architecture Diagram

Documentation source

HTML

schema.json

index.json

Markdown

Human readers

RAG / chatbot / coding agent / IDE

Figure 7 — Dual-path publishing architecture: rendered HTML for human readers, discovery schema and Markdown endpoints for machines.
LayerRole
MarkdownHolds the content.
YAML frontmatterHolds the metadata, including the classification that makes filtering possible.
schema.jsonThe discovery contract built from that metadata.
index.jsonThe searchable, filterable listing of the corpus it describes.
HTMLThe presentation layer, built from the same source for the humans reading it in a browser.

Retrofitting that frontmatter onto an existing corpus doesn’t touch a sentence of prose, because the classification is metadata, not content.

You don’t need to build a second documentation system for AI. You can make the existing documentation directly discoverable and consumable by machines.

The same source corpus serves both audiences at once. Nothing about it required writing the documentation twice.

Maya never had to know any of this to get her retry procedure. That’s the point.

External sources

  • llms.txt: the plain-text convention /llms.txt follows.
  • robots.txt: the traditional crawler directive protocol, permissions without content classification.
Hero image: “Audio plugs” by Jean-Etienne Minh-Duy Poirrier, licensed under CC BY-SA 2.0.

Continue reading

All articles