Skip to content

docs(ai-chat): document the chat.agent tools option#3791

Open
ericallam wants to merge 3 commits into
mainfrom
docs/ai-chat-tools
Open

docs(ai-chat): document the chat.agent tools option#3791
ericallam wants to merge 3 commits into
mainfrom
docs/ai-chat-tools

Conversation

@ericallam
Copy link
Copy Markdown
Member

Summary

Documents the new tools option on chat.agent (companion to #3790).

Adds a dedicated Tools guide: the three places tools show up (config, toStreamTextOptions, streamText), why declaring them on the config matters for toModelOutput across turns, static vs per-turn tools, the typed run() payload, InferChatUIMessageFromTools, the relationship to skills, and the manual convertToModelMessages path for customAgent loops.

Threads the option through the rest of the guide: the reference tables, a happy-path section on the backend page, the types page, and the HITL / skills / tool-result-auditing patterns. Corrects the sub-agents guide, where the toModelOutput compression was implied to work across turns but silently degraded from turn 2 without config tools.

Also unstacks the three callouts that were piled under the chat.agent() header on the backend page, and adds a changelog entry.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

⚠️ No Changeset found

Latest commit: 61dffcb

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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

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: b4b2ba75-52c6-45b9-b160-a97808d32b83

📥 Commits

Reviewing files that changed from the base of the PR and between 6f6fe0a and 61dffcb.

📒 Files selected for processing (12)
  • docs/ai-chat/backend.mdx
  • docs/ai-chat/changelog.mdx
  • docs/ai-chat/overview.mdx
  • docs/ai-chat/patterns/human-in-the-loop.mdx
  • docs/ai-chat/patterns/skills.mdx
  • docs/ai-chat/patterns/sub-agents.mdx
  • docs/ai-chat/patterns/tool-result-auditing.mdx
  • docs/ai-chat/quick-start.mdx
  • docs/ai-chat/reference.mdx
  • docs/ai-chat/tools.mdx
  • docs/ai-chat/types.mdx
  • docs/docs.json
✅ Files skipped from review due to trivial changes (8)
  • docs/ai-chat/patterns/skills.mdx
  • docs/ai-chat/overview.mdx
  • docs/ai-chat/quick-start.mdx
  • docs/ai-chat/patterns/tool-result-auditing.mdx
  • docs/ai-chat/changelog.mdx
  • docs/ai-chat/patterns/sub-agents.mdx
  • docs/ai-chat/backend.mdx
  • docs/ai-chat/tools.mdx
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/docs.json
  • docs/ai-chat/patterns/human-in-the-loop.mdx
  • docs/ai-chat/types.mdx
  • docs/ai-chat/reference.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). (3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Mintlify Deployment

Walkthrough

This PR adds a dedicated "Tools" guide and updates AI chat docs to document a config-level tools option on chat.agent so tool transforms (toModelOutput) are reapplied each turn. It updates the API reference (options, run payload, resolver event, and InferChatUIMessageFromTools), revises examples (HITL, skills, sub-agents, backend) to declare and thread tools into streamText, strengthens backend warnings about spreading chat.toStreamTextOptions first, and updates navigation and changelog entries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is well-structured with a clear summary of all changes. However, it does not follow the provided template which requires a checklist, testing section, changelog section, and screenshots section. While the summary is informative, consider using the repository's PR template format that includes checklist items, testing steps, and structured sections for consistency.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main documentation change: adding documentation for the chat.agent tools option.
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-tools

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.

@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Jun 1, 2026

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

Project Status Preview Updated (UTC)
trigger 🟢 Ready View Preview Jun 1, 2026, 3:02 PM

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

@ericallam ericallam marked this pull request as ready for review June 1, 2026 15:01
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/ai-chat/tools.mdx`:
- Around line 173-184: The snippet calls anthropic(...) but doesn’t import it,
causing copy/paste to fail; update the example to import anthropic from the ai
package (e.g., include anthropic in the import alongside convertToModelMessages
and streamText or add a separate import for anthropic) so the symbols anthropic,
convertToModelMessages, and streamText are all explicitly imported and the
snippet is runnable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4737fad4-5b2e-4eec-b30c-fa946184dbcf

📥 Commits

Reviewing files that changed from the base of the PR and between a1dc3c5 and 6f6fe0a.

📒 Files selected for processing (12)
  • docs/ai-chat/backend.mdx
  • docs/ai-chat/changelog.mdx
  • docs/ai-chat/overview.mdx
  • docs/ai-chat/patterns/human-in-the-loop.mdx
  • docs/ai-chat/patterns/skills.mdx
  • docs/ai-chat/patterns/sub-agents.mdx
  • docs/ai-chat/patterns/tool-result-auditing.mdx
  • docs/ai-chat/quick-start.mdx
  • docs/ai-chat/reference.mdx
  • docs/ai-chat/tools.mdx
  • docs/ai-chat/types.mdx
  • docs/docs.json
📜 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). (2)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (3)
docs/**/*.mdx

📄 CodeRabbit inference engine (docs/CLAUDE.md)

docs/**/*.mdx: MDX documentation pages must include frontmatter with title (required), description (required), and sidebarTitle (optional) in YAML format
Use Mintlify components for structured content: , , , , , , /, /
Always import from @trigger.dev/sdk in code examples (never from @trigger.dev/sdk/v3)
Code examples must be complete and runnable where possible
Use language tags in code fences: typescript, bash, json

Files:

  • docs/ai-chat/patterns/tool-result-auditing.mdx
  • docs/ai-chat/overview.mdx
  • docs/ai-chat/patterns/sub-agents.mdx
  • docs/ai-chat/quick-start.mdx
  • docs/ai-chat/patterns/skills.mdx
  • docs/ai-chat/reference.mdx
  • docs/ai-chat/patterns/human-in-the-loop.mdx
  • docs/ai-chat/types.mdx
  • docs/ai-chat/tools.mdx
  • docs/ai-chat/backend.mdx
  • docs/ai-chat/changelog.mdx
docs/**/docs.json

📄 CodeRabbit inference engine (docs/CLAUDE.md)

docs/**/docs.json: Main documentation config must be defined in docs.json which includes navigation structure, theme, and metadata
Navigation structure in docs.json should be organized using navigation.dropdowns with groups and pages

Files:

  • docs/docs.json
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

Code formatting must be enforced using Prettier before committing

Files:

  • docs/docs.json
🧠 Learnings (2)
📚 Learning: 2026-03-10T12:44:14.176Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3200
File: docs/config/config-file.mdx:353-368
Timestamp: 2026-03-10T12:44:14.176Z
Learning: In the trigger.dev repo, docs PRs are often companions to implementation PRs. When reviewing docs PRs (MDX files under docs/), check the PR description for any companion/related PR references and verify that the documented features exist in those companion PRs before flagging missing implementations. This ensures docs stay in sync with code changes across related PRs.

Applied to files:

  • docs/ai-chat/patterns/tool-result-auditing.mdx
  • docs/ai-chat/overview.mdx
  • docs/ai-chat/patterns/sub-agents.mdx
  • docs/ai-chat/quick-start.mdx
  • docs/ai-chat/patterns/skills.mdx
  • docs/ai-chat/reference.mdx
  • docs/ai-chat/patterns/human-in-the-loop.mdx
  • docs/ai-chat/types.mdx
  • docs/ai-chat/tools.mdx
  • docs/ai-chat/backend.mdx
  • docs/ai-chat/changelog.mdx
📚 Learning: 2026-04-30T20:30:29.458Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3226
File: docs/ai-chat/quick-start.mdx:13-13
Timestamp: 2026-04-30T20:30:29.458Z
Learning: In this repo’s documentation MDX files (`docs/**/*.mdx`), use `ts` and `tsx` (not `typescript`) as the code-fence language tags for TypeScript/TSX snippets. Do not flag `ts`/`tsx` code-fence language tags as incorrect in any docs MDX file, since this is the site-wide Mintlify-compatible convention.

Applied to files:

  • docs/ai-chat/patterns/tool-result-auditing.mdx
  • docs/ai-chat/overview.mdx
  • docs/ai-chat/patterns/sub-agents.mdx
  • docs/ai-chat/quick-start.mdx
  • docs/ai-chat/patterns/skills.mdx
  • docs/ai-chat/reference.mdx
  • docs/ai-chat/patterns/human-in-the-loop.mdx
  • docs/ai-chat/types.mdx
  • docs/ai-chat/tools.mdx
  • docs/ai-chat/backend.mdx
  • docs/ai-chat/changelog.mdx
🔇 Additional comments (11)
docs/ai-chat/changelog.mdx (1)

7-29: LGTM!

docs/ai-chat/overview.mdx (1)

81-83: LGTM!

docs/ai-chat/quick-start.mdx (1)

154-154: LGTM!

docs/ai-chat/patterns/tool-result-auditing.mdx (1)

11-11: LGTM!

docs/docs.json (1)

110-110: LGTM!

docs/ai-chat/reference.mdx (1)

48-49: LGTM!

Also applies to: 91-92, 196-206, 548-560

docs/ai-chat/patterns/human-in-the-loop.mdx (1)

72-73: LGTM!

Also applies to: 77-77, 85-86

docs/ai-chat/patterns/sub-agents.mdx (1)

208-210: LGTM!

Also applies to: 244-254, 261-262

docs/ai-chat/patterns/skills.mdx (1)

188-189: LGTM!

docs/ai-chat/backend.mdx (1)

28-41: LGTM!

Also applies to: 154-180

docs/ai-chat/types.mdx (1)

51-53: LGTM!

Also applies to: 89-89, 97-99, 102-102

Comment thread docs/ai-chat/tools.mdx
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment thread docs/ai-chat/tools.mdx
ericallam added 3 commits June 1, 2026 16:52
Document declaring tools on chat.agent: why it matters for toModelOutput
across turns, static vs per-turn tools, the typed tools handed back on the
run payload, typing messages via InferChatUIMessageFromTools, how config
tools relate to skills and toStreamTextOptions, and the manual
convertToModelMessages path for customAgent loops.
Three callouts (Tip, Info, Warning) were stacked back-to-back right under
the chat.agent() header before any content. Lead with the intro and first
example instead: the toStreamTextOptions warning now sits with the example
it's about, and the durable-Session note moved to its own short section.
Adds a tools row to ChatAgentOptions and a tools field to the run payload
in the reference, plus ResolveToolsEvent and InferChatUIMessageFromTools.
Corrects the sub-agents guide so the toModelOutput compression survives
across turns (declare tools on the config; convertToModelMessages with tools
in customAgent loops). Adds a happy-path Tools section to the backend page,
collapses the manual UIMessage triple in types, aligns the HITL and skills
examples, and adds a changelog entry plus Tools links from overview and
quick start.
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread docs/ai-chat/changelog.mdx
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.

1 participant