|
| 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. |
0 commit comments