> ## Documentation Index
> Fetch the complete documentation index at: https://docs.waniwani.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent pages

> Serve AI agents a lighter, stored copy of your pages, with the MCP tools of your Waniwani agent at the top.

An agent page is a copy of one of your pages that Waniwani renders and stores. When an AI agent asks for a path that you serve, the relay sends it the agent page. All other requests go to your site with no change.

## Before you start

* The relay must be live on the website. See [Add a website](https://docs.waniwani.ai/agent-traffic/overview.md#add-a-website).

* The relay code must call `serveAgentPage`. On CloudFront, it must have the two functions. On ASP.NET on IIS, the module does it, and you do not change code. See the pages for [Vercel](https://docs.waniwani.ai/agent-traffic/vercel.md#with-agent-pages-or-blocking), [Cloudflare](https://docs.waniwani.ai/agent-traffic/cloudflare.md#with-agent-pages-or-blocking), [AWS CloudFront](https://docs.waniwani.ai/agent-traffic/cloudfront.md#with-agent-pages-or-blocking), [self-hosted Next.js](https://docs.waniwani.ai/agent-traffic/self-hosted.md#with-agent-pages-or-blocking) and [ASP.NET on IIS](https://docs.waniwani.ai/agent-traffic/aspnet.md).

* The relay must run on each path that you serve. If you set up the relay for **Only some paths**, add these paths to its matcher, routes or behaviors.

If the code does not call `serveAgentPage`, the **Agent pages** card shows **Your relay does not serve these pages yet.** Click **See what to change**. The **Relay** card shows the lines to change in your code.

## Turn on agent pages

**1. Turn on the switch**

Open the website and go to **Settings**. In the **Agent pages** card, turn on the switch.

**2. Select the MCP tools**

In **MCP tools to give agents**, select a Waniwani agent, or **No tools**. This row shows only when your organization has a Waniwani agent.

**3. Select the paths**

Go to **Pages**. Click **Serve** next to each path that you want to serve. In **Suggested paths to add**, click **Add** or **Add all**. The suggestions come from the last readiness scan.

A change gets to the relay in approximately 2 minutes. You do not deploy again. The relay serves a path when its agent page is ready.

## Paths

| Entry | Covers | Rendered |
| - | - | - |
| `/pricing` | `/pricing` only | At once |
| `/products/*` | `/products` and each path below it | On the first agent visit to each path |

A website can have 200 path entries and 1,000 stored agent pages. Until a folder page is ready, the agent gets your normal page. If a folder entry covers a path, you cannot change that path alone.

To stop serving a path, open the **⋯** menu of the path in **Pages** and click **Stop serving**.

## Who gets an agent page

The relay sends the agent page when all of these are true:

* The website has agent pages on, and the path is served.
* The method is `GET` or `HEAD`.
* The request comes from an AI agent, or it asks for Markdown in its `Accept` header.
* The agent page is ready, and it gets to the relay in time: the headers in 300 ms and the body in 1 second. The body is 1 MB at most.

An agent that reads the page for a person gets Markdown when its `Accept` header lists `text/markdown`. If not, it gets HTML. Other clients get Markdown only when they prefer Markdown to HTML. If not, they get your normal page.

If a condition is false, or if Waniwani does not answer in time, the request goes to your site with no change. An error in the relay never breaks your page.

An agent page response has these headers:

```http theme={null}
x-waniwani-agent-page: hit
cache-control: private, no-store
vary: user-agent, accept
```

## What is in an agent page

Waniwani opens your page in a headless browser and waits until the network is idle. Then it keeps the page and removes:

* Scripts, except JSON-LD and the Waniwani chat embed
* `<noscript>` blocks and HTML comments
* `<link>` tags, except `canonical`, `alternate`, `author`, `license`, `prev` and `next`
* Inline event handlers, such as `onclick`
* The Waniwani chat widget that the embed shows on the page

Relative links and image addresses become full addresses on your site.

When you select a Waniwani agent, each agent page starts with an **MCP tools** section after the first heading. The section shows the address of the MCP server and the name and description of each tool in the production environment of the agent. If the page has no Waniwani chat embed, Waniwani adds the embed in `off` mode. Thus, an agent in a browser with [WebMCP](https://docs.waniwani.ai/platform/webmcp.md) also gets the tools.

## How pages stay current

When the relay records an agent visit to a ready page, Waniwani gets your live page again. It does this one time in 5 minutes for each path, at most. If the HTML changed, Waniwani renders the agent page again.

If your page answers `404` or `410`, the agent page shows **Failed** and agents get your normal page.

Waniwani also checks the pages one time each hour:

* A failed page renders again after 1 day. If your page answered `404` or `410`, it renders again after 14 days.
* If no agent visited a ready page for 14 days, Waniwani gets your live page again and renders the agent page again if the HTML changed.

To render a page again now, click **Check again** in the **⋯** menu of the path, or **Check now** on the page of the path. When you select a different Waniwani agent for the tools, Waniwani renders all pages again.

## Check and preview

In **Pages**, each path shows its status:

| Status | Meaning |
| - | - |
| **Agent page · ready** | Agents get the agent page. |
| **Agent page · queued** | The render starts soon. |
| **Agent page · rendering** | Waniwani renders the page now. |
| **Agent page · failed** | The render did not work. Agents get your normal page. |
| **Not served · suggested** | The last readiness scan suggests this path. |
| **Not served** | Agents get your normal page. |

The **Tokens** column shows the tokens of your page and of the agent page.

Click a path to open its page. The **Serve to agents** switch serves or stops the path. If the render failed, the page shows the reason. The preview has the tabs **What agents get**, **What people see** and **Compare**:

* **What agents get**: select **Markdown** or **HTML**, and **Rendered** or **Source**.
* **What people see**: **Rendered** shows a browser screenshot of the top of your page, with the time of the screenshot. **Source** shows the first 4,000 characters of your HTML.

The **Estimated tokens saved** tile multiplies the token difference by the requests from agents that answer people. It does not count the agents that you block on the website. It also counts the requests from before the agent page was ready, so it is an estimate.

**Copy test command** copies a command that asks your live site for the page as an agent does:

```bash theme={null}
curl -A "ChatGPT-User" -H "Accept: text/markdown" 'https://www.example.com/pricing' -i
```

## More settings

When agent pages are on, **Settings** shows three more cards.

### Goals

Agents pick a goal at the top of your `llms.txt`. Each goal has a link, `/llms.txt?goal=` and its name, and up to 5 pages that agents must read. A website can have 12 goals. Click **Suggest again** to get suggestions, and **Approve** to use one. Click **Add goal** to write your own.

### Agent files

Agents look for files at fixed addresses, such as `/llms.txt`, `/robots.txt`, `/agents.md` and `/.well-known/mcp.json`. Waniwani writes these files from your site. You can edit them. Click **Publish** to serve them through the relay. Click **Regenerate** to write them again.

| Status | Meaning |
| - | - |
| **Published** | The relay serves this file. |
| **Ready to publish** | The file is written. Click **Publish**. |
| **Not published** | The relay does not serve this file. |
| **Not written** | Click **Write it**. |

A file from your own site shows **Yours** in the **Source** column.

### Protocols

Each protocol goes on or off at once, with no deploy.

| Protocol | What it does |
| - | - |
| **Markdown for agents** | Agents that ask for Markdown get it. It follows the agent pages switch. |
| **Ask (NLWeb)** | Agents send questions to `/ask` and get answers from your pages. It needs agent pages. If your site already answers `/ask`, it stays off until you turn it on. |

**MCP** and **WebMCP** show **Not available yet**.

## Troubleshooting

> [accordion] A page stays Failed
>
> Waniwani renders from your public `https` address. A firewall or a bot protection rule can stop the render. The relay lets the render request through to your site, because it has the header `x-waniwani-render`.

> [accordion] The card says that your relay does not serve these pages
>
> Your code does not call `serveAgentPage`. On CloudFront, the viewer request function from the newest zip is not attached. Click **See what to change**, change the code and deploy. Then click **Check now**.

> [accordion] The card says that no agent page came back from your website
>
> This is on CloudFront. The origin request function is not on the behavior. Attach `origin-request.mjs` as **Origin request** on the same behaviors, deploy and click **Check now**.

> [accordion] The test command returns your normal page
>
> Make sure that the path shows **Agent page · ready**, and that the relay runs on that path. A new setting can need 2 minutes to get to the relay.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.