Skip to content

Commit 09ac4ee

Browse files
Document agent feedback feature for AI agents
1 parent 0b40e72 commit 09ac4ee

7 files changed

Lines changed: 78 additions & 3 deletions

File tree

fern/products/docs/docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ navigation:
204204
- page: API catalog discovery
205205
path: ./pages/ai/api-catalog.mdx
206206
slug: api-catalog
207+
- page: Agent feedback
208+
path: ./pages/ai/agent-feedback.mdx
209+
slug: agent-feedback
207210
- section: Ask Fern
208211
slug: ask-fern
209212
contents:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Agent feedback
3+
description: Collect structured feedback from AI agents about your documentation quality, coverage, and clarity.
4+
---
5+
6+
Fern automatically instructs AI agents to submit feedback after they consume your documentation. The feedback endpoint is included in the [default page directive](/learn/docs/ai-features/agent-directives) and in the `## Agent Feedback` section appended to [`llms.txt` and `llms-full.txt`](/learn/docs/ai-features/llms-txt), so agents discover it without any configuration on your part.
7+
8+
When an agent reads a page, the directive tells it to POST a short report — what worked, what was unclear, or what was missing — along with the page URL and a sentiment signal. This gives you structured, machine-generated signal about documentation quality that complements [human on-page feedback](/learn/docs/customization/user-feedback).
9+
10+
## How it works
11+
12+
Every agent-facing response includes the feedback endpoint URL and request schema:
13+
14+
1. **Per-page Markdown** (`.md` URLs): the default directive includes a one-line reference to the endpoint.
15+
2. **`llms.txt` and `llms-full.txt`**: an `## Agent Feedback` section at the end of the response contains the full endpoint URL, expected headers, and JSON body schema.
16+
17+
Agents are instructed to report **positive** feedback when documentation was clear and helped complete the user's task, and **negative** feedback when they encountered errors, missing information, or confusing instructions.
18+
19+
No setup is required. The endpoint and directives are enabled automatically for all Fern documentation sites.
20+
21+
## Endpoint reference
22+
23+
```
24+
POST https://fai.buildwithfern.com/agent-feedback/{domain}
25+
Content-Type: application/json
26+
```
27+
28+
| Field | Type | Required | Description |
29+
| --- | --- | --- | --- |
30+
| `page_url` | `string` | At least one of `page_url` or `message` | The documentation page URL the feedback is about. |
31+
| `message` | `string` | At least one of `page_url` or `message` | Free-text feedback from the agent. |
32+
| `agent_name` | `string` | No | Name or identifier of the agent submitting feedback. |
33+
| `sentiment` | `"positive"` \| `"negative"` | No | Whether the documentation experience was positive or negative. |
34+
35+
`{domain}` is your documentation site's domain (e.g., `docs.example.com`).
36+
37+
### Example request
38+
39+
```bash
40+
curl -X POST https://fai.buildwithfern.com/agent-feedback/docs.example.com \
41+
-H "Content-Type: application/json" \
42+
-d '{
43+
"page_url": "https://docs.example.com/getting-started",
44+
"message": "Authentication section was clear and complete.",
45+
"agent_name": "Claude",
46+
"sentiment": "positive"
47+
}'
48+
```
49+
50+
### Validation and limits
51+
52+
- At least one of `page_url` or `message` is required. Requests with neither return `400`.
53+
- `sentiment` must be `"positive"` or `"negative"` if provided. Other values return `422`.
54+
- `message` and `page_url` are truncated to 2,000 characters; `agent_name` to 100.
55+
- Rate limits: 10 requests per minute and 100 per day per IP address. Exceeding the limit returns `429` with a `Retry-After` header.

fern/products/docs/pages/ai/llms-txt/directives.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ description: Configure the default directive prepended to every page served to A
66
Every page served to AI agents is automatically prepended with a default directive that tells agents how to navigate your documentation programmatically:
77

88
```text title="Default page directive" wordWrap
9-
For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.example.com/llms.txt. For full documentation content, see https://docs.example.com/llms-full.txt.
9+
For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.example.com/llms.txt. For full documentation content, see https://docs.example.com/llms-full.txt. For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.example.com/_mcp/server. To submit feedback about these docs, POST to https://fai.buildwithfern.com/agent-feedback/docs.example.com with JSON body: { "page_url": "string", "message": "string", "agent_name": "string", "sentiment": "positive" | "negative" }.
1010
```
1111

1212
The URLs in the directive are generated from your site's domain and basepath. The directive is injected after the frontmatter metadata section but before the page body, so agents see it first even if they truncate the rest of the page. It applies to individual page Markdown (`.md`/`.mdx` URLs) and to each page section within `llms-full.txt`, and human-facing documentation is unaffected.
1313

14+
The directive also includes the [agent feedback](/learn/docs/ai-features/agent-feedback) endpoint URL and schema, instructing agents to submit feedback about documentation quality after answering a query.
15+
1416
## Customize agent directives
1517

1618
To override the default, set a custom directive using the [`agents` key in `docs.yml`](/learn/docs/configuration/site-level-settings#agents-configuration):

fern/products/docs/pages/ai/llms-txt/overview.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The two files differ:
7070

7171
## Learn more
7272

73-
<CardGroup cols={3}>
73+
<CardGroup cols={2}>
7474
<Anchor id="custom-files">
7575
<Card title="Customize LLM output" icon="sliders" href="/learn/docs/ai-features/customize-llm-output">
7676
Exclude pages, filter content with tags, or serve your own custom files.
@@ -82,5 +82,8 @@ The two files differ:
8282
<Card title="Analytics and integration" icon="chart-line" href="/learn/docs/ai-features/llms-txt-analytics">
8383
Track LLM traffic and surface `llms.txt` endpoints to readers.
8484
</Card>
85+
<Card title="Agent feedback" icon="message-lines" href="/learn/docs/ai-features/agent-feedback">
86+
Collect structured feedback from AI agents about documentation quality.
87+
</Card>
8588
</CardGroup>
8689

fern/products/docs/pages/ai/overview.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ Your site is automatically optimized for AI tools and search engines. Fern hosts
4747
<Card title="`llms.txt`" icon="file-text" href="/learn/docs/ai-features/llms-txt" />
4848
<Card title="Agent directives" icon="compass" href="/learn/docs/ai-features/agent-directives" />
4949
<Card title="API catalog discovery" icon="radar" href="/learn/docs/ai-features/api-catalog" />
50+
<Card title="Agent feedback" icon="message-lines" href="/learn/docs/ai-features/agent-feedback" />
5051
</CardGroup>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
tags: ["ai"]
3+
---
4+
5+
## Agent feedback
6+
7+
AI agents can now submit structured feedback about your documentation. Fern automatically includes a feedback endpoint in the [default page directive](/learn/docs/ai-features/agent-directives) and in a dedicated `## Agent Feedback` section appended to `llms.txt` and `llms-full.txt`, so agents discover it without any setup.
8+
9+
Agents report whether documentation was helpful (positive sentiment) or encountered issues like missing information or confusing instructions (negative sentiment). Feedback is collected per-domain with rate limiting.
10+
11+
<Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/ai-features/agent-feedback">Read the docs</Button>

fern/products/docs/pages/customization/user-feedback.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Collect on-page feedback and enable edit suggestions from users in
55
---
66

77

8-
Fern offers a variety of ways to track feedback and suggested improvements from users.
8+
Fern offers a variety of ways to track feedback and suggested improvements from users. For feedback submitted by AI agents rather than human visitors, see [agent feedback](/learn/docs/ai-features/agent-feedback).
99

1010
## On-page feedback
1111

0 commit comments

Comments
 (0)