Reference Python SDK for the Docs Feedback Protocol
Project description
fixyourdocs (Python SDK)
Reference Python SDK for the Docs Feedback Protocol v0. The protocol lets AI agents file structured reports against documentation pages when the docs break agent task flows.
- Full docs: https://docs.fixyourdocs.io/sdk/python/.
- Spec: https://docsfeedback.org.
- Why this exists: the FixYourDocs manifesto.
Install
pip install fixyourdocs
Requires Python 3.9+.
CLI
The package ships a fixyourdocs console script covering the two
one-liners from the agents-md-snippet
README:
# Adds the canonical AGENTS.md block to your repo. Idempotent.
pipx run fixyourdocs init
# Sends a single report to the Hub.
pipx run fixyourdocs report \
--doc-url https://example.com/docs/install \
--summary "Install fails on macOS 14" \
--agent claude-code \
--kind broken
init auto-detects AGENTS.md, CLAUDE.md, .cursor/rules, or
.github/copilot-instructions.md and appends to whichever exists
(falling back to creating AGENTS.md). Pass --file <path> to override.
init --global instead writes the consumer-side "report stale
third-party docs" block to a global agent-config file (default
~/.claude/CLAUDE.md, override with --file). Use this when you want an
agent to offer to report broken third-party docs it consults across
all your projects, rather than wiring the per-repo block into one repo.
It is idempotent.
report accepts --details, --suggested-fix, --api-url, --token,
and --json for machine-readable output. Exit codes: 0 success,
2 user error, 1 transport or server error.
Usage (sync)
from fixyourdocs import Client, Report
report = Report.create(
doc_url="https://docs.example.com/getting-started",
summary="The page does not document how to set the API_KEY env var.",
kind="missing",
agent_name="claude-code",
)
with Client(api_url="https://hub.fixyourdocs.io") as client:
result = client.send(report)
print(result.id, result.is_duplicate)
Usage (async)
import asyncio
from fixyourdocs import AsyncClient, Report
async def main() -> None:
report = Report.create(
doc_url="https://docs.example.com/getting-started",
summary="The page does not document how to set the API_KEY env var.",
kind="missing",
agent_name="claude-code",
)
async with AsyncClient(api_url="https://hub.fixyourdocs.io") as client:
result = await client.send(report)
print(result.id, result.is_duplicate)
asyncio.run(main())
API shape
The wire format is a nested object (agent, report, task_context),
so the SDK exposes two ways to build a Report:
Report.create(...)— ergonomic, flat keyword-argument constructor for the common case. Internally builds the nested wire-format structure.Report(agent=AgentInfo(...), report=ReportBody(...), ...)— the typed nested form, useful when constructing reports programmatically from already-typed sub-objects.
Both produce identical wire output.
Consumer-side mode
When an agent reports against third-party docs it consulted (rather
than your own first-party docs), the client defaults guard against
leaking private context and against pestering hosts that have opted out.
All three options are constructor arguments on both Client and
AsyncClient:
from fixyourdocs import Client, PrivacyError, OptedOutError
with Client(api_url="https://hub.fixyourdocs.io") as client:
client.send(report) # guards run before any network call
enforce_privacy=True(default) — before any network call, validatesreport.doc_urland raisesPrivacyError(no request is made) unless it is a publichttps://page. Rejected: non-httpsschemes; missing hosts;localhostand.localhost/.local/.internalnames; bare single-label hostnames; and IP literals in loopback / private / link-local / reserved ranges. Passenforce_privacy=Falsefor first-party / self-hosted / internal docs.include_transcript=False(default) — stripstask_context.transcript_excerptfrom the wire body (droppingtask_contextentirely if nothing else remains) so transcript snippets never leave the machine unless you opt in withinclude_transcript=True. YourReportobject is never mutated.discover_opt_out=True(default) — before posting, fetcheshttps://<doc-host>/.well-known/docs-feedback.json; if the host publishedopt_in: false,send()raisesOptedOutErrorand does not post. The result is cached per host for 24h. Missing/invalid well-known files are treated as opted-in.
Errors
Non-2xx responses raise typed exceptions:
| Status | Exception |
|---|---|
| 400 | ValidationError (.details) |
| 401 | AuthError |
| 404 | NotFoundError |
| 410 | OptedOutError (.since) |
| 413 | PayloadTooLargeError (.max_bytes) |
| 415 | UnsupportedMediaTypeError |
| 422 | PolicyRejectedError (.reason) |
| 429 | RateLimitedError (.retry_after) |
| 5xx | ServerError (after one automatic retry on 502/503/504) |
All inherit from FixYourDocsError. In consumer-side mode, send() may
also raise PrivacyError (non-public doc_url) or OptedOutError
(host opted out via its .well-known file) before any request is
posted.
Licence
Apache License 2.0 — see LICENSE.
Contributing
Contributions require a DCO sign-off and a signed Apache Individual Contributor License Agreement — see CONTRIBUTING.md.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fixyourdocs-0.3.1.tar.gz.
File metadata
- Download URL: fixyourdocs-0.3.1.tar.gz
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31b81a424cd807ff836e5c25bfe0fd32ebbb6940625eba99d82b856015e4ca98
|
|
| MD5 |
d4faa4ea7d74b330ccec3729756a6e85
|
|
| BLAKE2b-256 |
e1712d5e78a1ff2a994e87cb911bf5ffa3a69b08fc8fc6702cf50e3615cb2a0a
|
Provenance
The following attestation bundles were made for fixyourdocs-0.3.1.tar.gz:
Publisher:
publish.yml on fixyourdocs/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fixyourdocs-0.3.1.tar.gz -
Subject digest:
31b81a424cd807ff836e5c25bfe0fd32ebbb6940625eba99d82b856015e4ca98 - Sigstore transparency entry: 1899230164
- Sigstore integration time:
-
Permalink:
fixyourdocs/sdk-python@b1afe3cb3390a07f81bdf087803323537552e8b6 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/fixyourdocs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b1afe3cb3390a07f81bdf087803323537552e8b6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fixyourdocs-0.3.1-py3-none-any.whl.
File metadata
- Download URL: fixyourdocs-0.3.1-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d662efac0a67a0b6750c5e3496672a5207dcae41a42c984c2279572104111028
|
|
| MD5 |
82d3ef283be24502a48b5a1de6e1ba06
|
|
| BLAKE2b-256 |
e2775ac1945b29c5a84a11a3acb8d914ec31c50f6709c8b969fc2669a9f2bb7f
|
Provenance
The following attestation bundles were made for fixyourdocs-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on fixyourdocs/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fixyourdocs-0.3.1-py3-none-any.whl -
Subject digest:
d662efac0a67a0b6750c5e3496672a5207dcae41a42c984c2279572104111028 - Sigstore transparency entry: 1899230322
- Sigstore integration time:
-
Permalink:
fixyourdocs/sdk-python@b1afe3cb3390a07f81bdf087803323537552e8b6 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/fixyourdocs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b1afe3cb3390a07f81bdf087803323537552e8b6 -
Trigger Event:
push
-
Statement type: