Skip to content

docs(ai-chat): custom agents page, backend decision table, and a building-agents anatomy entry#3921

Merged
ericallam merged 4 commits into
mainfrom
docs/ai-chat-custom-agents-and-anatomy
Jun 12, 2026
Merged

docs(ai-chat): custom agents page, backend decision table, and a building-agents anatomy entry#3921
ericallam merged 4 commits into
mainfrom
docs/ai-chat-custom-agents-and-anatomy

Conversation

@ericallam

Copy link
Copy Markdown
Member

Summary

Documents the two lower-level chat backend APIs and restructures the Building agents section so it has a sane reading order.

Custom agents page. chat.customAgent() was effectively undocumented (one passing mention) and chat.createSession() was buried at the bottom of the Backend page, prompted by a customer asking whether dropping down a level was supported at all. Both now live on one dedicated page framed as a composition: register with customAgent, then drive turns with the managed createSession iterator or a hand-rolled primitives loop. The page covers the patterns the managed lifecycle otherwise handles for you, each verified against a running agent: seeding history on continuation runs (and why the seed must go through the turn-0 addIncoming, which replaces the accumulator), persisting the user message before streaming so a mid-stream reload keeps it, racing totalUsage after a stop so the loop cannot wedge, and the single-message wire shape.

Backend page. Now leads with a decision table across the three abstraction levels and focuses on chat.agent(), routing to the new page. Stale examples that read a plural messages field off the wire payload are fixed (copy-pasting them broke turn accumulation), and the ChatSessionOptions / ChatTurn reference tables gain their missing rows (compaction, pendingMessages, usage fields, setMessages, prepareStep).

Anatomy page + reorder. The Building agents group opened with the long How it works mechanics page, a wall right after the Quick Start. A short Anatomy page now leads the group: the three moving parts, one annotated example where each region names the page that covers it, and a routing table. How it works moves to the end of the group as the depth payoff, matching where peer docs put their internals pages.

All pages visually verified against a local Mintlify build; cross-links and anchors updated across the section.

…reference

Adds a dedicated Custom agents page covering chat.customAgent (agent
registration + session binding) and both loop styles: the managed
createSession iterator and the hand-rolled primitives loop. Includes
the patterns the managed lifecycle otherwise covers for you:
continuation history seeding, persisting the user message before
streaming, racing totalUsage after a stop, and the slim wire shape.

The Backend page leads with a decision table across the three
abstraction levels and now focuses on chat.agent, routing to the new
page. Completes the ChatSessionOptions and ChatTurn reference tables
(compaction, pendingMessages, usage fields, setMessages, prepareStep)
and fixes stale examples that read a plural messages field off the
wire payload.
The Building agents group opened with the long How it works mechanics
page, which is the wrong first step after the Quick Start. A new
Anatomy page now leads the group: the three moving parts (agent task,
session, frontend transport), one annotated chat.agent example where
each region names the page that covers it, and a routing table for the
group. No setup steps, explicitly skippable.

How it works moves to the end of the group as the depth payoff, the
position peers (Clerk, LangGraph) give their internals pages. Also
registers the Custom agents page at the bottom of the group.
@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3415122

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f7e9577d-976a-4187-b03d-cb2ee1a6f19e

📥 Commits

Reviewing files that changed from the base of the PR and between 965b814 and 3415122.

📒 Files selected for processing (1)
  • docs/ai-chat/tools.mdx
✅ Files skipped from review due to trivial changes (1)
  • docs/ai-chat/tools.mdx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)

Walkthrough

This PR reorganizes the agent documentation to establish a clearer information architecture. It introduces a foundational "anatomy" page explaining the three-part structure (backend loop, session, frontend integration), creates a comprehensive "custom agents" reference covering both managed and hand-rolled execution patterns, consolidates duplicated content in the backend guide, documents new session/turn API options in the reference, redirects all relevant cross-document links to the new structure, and updates navigation to reflect the new pages.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides comprehensive details about the changes but does not follow the required template structure (missing checklist, testing, changelog, and screenshots sections). Update the description to follow the template format by including all required sections: checklist, testing, changelog, and screenshots sections with appropriate content filled in.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding a custom agents documentation page, a backend decision table, and an anatomy entry for the building-agents section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/ai-chat-custom-agents-and-anatomy

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ericallam ericallam marked this pull request as ready for review June 12, 2026 11:41
@mintlify

mintlify Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
trigger 🟢 Ready View Preview Jun 12, 2026, 11:45 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

devin-ai-integration[bot]

This comment was marked as resolved.

Inbound deep links to the sections that moved to the Custom agents
page (#chat-createsession, #chat-customagent, #raw-task-with-primitives)
now land on the router stub instead of the top of the Backend page.
Path-level redirects cannot cover this since fragments never reach the
server.
devin-ai-integration[bot]

This comment was marked as resolved.

@ericallam ericallam merged commit 3bc3a17 into main Jun 12, 2026
19 checks passed
@ericallam ericallam deleted the docs/ai-chat-custom-agents-and-anatomy branch June 12, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants