docs: clarify Agents vs Chats API reference pages#26021
Draft
blinkagent[bot] wants to merge 3 commits into
Draft
docs: clarify Agents vs Chats API reference pages#26021blinkagent[bot] wants to merge 3 commits into
blinkagent[bot] wants to merge 3 commits into
Conversation
The REST API reference pages for /api/v2/workspaceagents (rendered as
# Agents) and /api/experimental/chats (rendered as # Chats) were easy to
confuse because:
- Both pages had no descriptive intro under the heading.
- The sidebar entry "Agents" suggests the AI Coder Agents product,
when in fact those endpoints are the workspace agent daemon
(coder_agent Terraform resource).
This change:
- Adds @tag.name / @tag.description annotations for the Agents and
Chats Swagger tags in coderd/coderd.go. The widdershins template
already renders data.resource.description directly under the
section heading, so the descriptions now appear on both pages.
- Renames the sidebar entry from "Agents" to "Workspace Agents" and
adds descriptions to both API sidebar entries in docs/manifest.json.
- Regenerates coderd/apidoc/swagger.json, coderd/apidoc/docs.go, and
the two affected reference pages.
Docs preview📖 View docs preview for |
The apidoc postprocess (scripts/apidocgen/postprocess/main.go) regenerates the REST API sidebar entries from the Swagger tags. It preserves description / state / icon_path on existing entries by matching them by title, then always overwrites Title to match the Swagger tag name. Renaming the sidebar entry from "Agents" to "Workspace Agents" therefore gets reverted by `make gen`, which causes the CI gen check to fail. Keep the title as "Agents" (matching the Swagger tag) so the description survives regeneration. Renaming the sidebar entry would require renaming the Swagger tag (and all `// @tags Agents` annotations across the codebase), which is out of scope for this PR.
The repo enforces a no-emdash/endash lint (scripts/check_emdash.sh). Biome unescaped the JSON \u2014 escape into a literal em dash, which tripped lint/emdash. Use two sentences instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The REST API reference page at
/docs/reference/api/agentsis confusing: by the name alone, a reader looking for the AI Coder Agents programmatic API would assume this is the right page. In fact, those endpoints are for the workspace agent daemon (thecoder_agentTerraform resource /workspaceagentdaemon). The actual AI Coder Agents API is documented at/docs/reference/api/chats.Both pages compound the confusion by being rendered with a bare
# Agents/# Chatsheading and no descriptive intro. The sidebar entries are similarly ambiguous (AgentsandChatswith no descriptions).Root cause
The reference pages are generated by
scripts/apidocgen/generate.sh(swag → widdershins → postprocess). The widdershins template (scripts/apidocgen/markdown-template/main.dot) already rendersdata.resource.descriptiondirectly under each section heading:…but the swag annotations in
coderd/coderd.gonever declared@tag.name/@tag.descriptionfor any tag, so the descriptions were always empty.Changes
coderd/coderd.go: add@tag.name Agents/@tag.description …and@tag.name Chats/@tag.description …annotations next to the existing@title/@versionblock.docs/manifest.json: rename the sidebar entryAgents→Workspace Agentsand adddescriptionfields to both API sidebar entries (every other top-level section in the manifest has descriptions; the API children did not).coderd/apidoc/swagger.json,coderd/apidoc/docs.go,docs/reference/api/agents.md, anddocs/reference/api/chats.mdviascripts/apidocgen/generate.sh+pnpm exec markdownlint-cli2 --fix+pnpm exec markdown-table-formatter+scripts/biome_format.sh(matching the Makefile'scoderd/apidoc/.genpipeline).Resulting diff is intentionally minimal — 6 files, 35 insertions / 3 deletions.
After this PR
The Agents page will render:
The Chats page will render:
And the sidebar entry for the workspace-agent endpoints becomes
Workspace Agentsinstead ofAgents.Out of scope (potential follow-ups)
docs/reference/api/chat.mdis a 7-byte stub — likely dead. Could be deleted in a follow-up.AgentsSwagger tag (and/or thecoder_agentTerraform resource) to something likeWorkspace Agents/workspace_daemonwould more thoroughly fix the naming collision, but that's a much bigger change.Created on behalf of @mattvollmer.