docs: add AI SDK harness agent pattern for chat.agent#3940
Conversation
Show how to run a Vercel AI SDK HarnessAgent (Claude Code/Codex/Pi) inside a chat.agent run(): the harness supplies the agent brain, while chat.agent supplies durable sessions, suspend/resume, and the useChat transport. HarnessAgent.stream() returns a StreamTextResult, so it pipes from run() exactly like streamText. https://claude.ai/code/session_018PVZy5kT3QcyKixcAF9sSF
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
WalkthroughThis PR adds a new documentation page explaining how to integrate Vercel AI SDK 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 361f5378-e599-43f6-8c88-e936e1484f0f
📒 Files selected for processing (2)
docs/ai-chat/patterns/ai-sdk-harness.mdxdocs/docs.json
📜 Review details
🧰 Additional context used
📓 Path-based instructions (3)
docs/**/docs.json
📄 CodeRabbit inference engine (docs/CLAUDE.md)
docs/**/docs.json: Main documentation config must be defined indocs.jsonwhich includes navigation structure, theme, and metadata
Navigation structure indocs.jsonshould be organized usingnavigation.dropdownswith groups and pages
Files:
docs/docs.json
**/*.{js,ts,tsx,jsx,css,json,md}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier for code formatting and run
pnpm run formatbefore committing
Files:
docs/docs.json
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/sdkin 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/ai-sdk-harness.mdx
🧠 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/ai-sdk-harness.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/ai-sdk-harness.mdx
🪛 GitHub Actions: 📚 Docs Checks / 0_check-broken-links.txt
docs/ai-chat/patterns/ai-sdk-harness.mdx
[error] 155-155: mintlify broken-links failed with a syntax error: Unable to parse file. Unexpected closing slash '/' in tag, expected an open tag first.
🪛 GitHub Actions: 📚 Docs Checks / check-broken-links
docs/ai-chat/patterns/ai-sdk-harness.mdx
[error] 155-155: Mintlify broken-links failed: Syntax error - Unable to parse ai-chat/patterns/ai-sdk-harness.mdx - 155:2-155:3: Unexpected closing slash / in tag, expected an open tag first
🪛 LanguageTool
docs/ai-chat/patterns/ai-sdk-harness.mdx
[style] ~15-~15: Consider an alternative for the overused word “exactly”.
Context: ...ence/ai-sdk-core/stream-text), which is exactly what [chat.agent's run()](/ai-chat/...
(EXACTLY_PRECISELY)
🔇 Additional comments (1)
docs/docs.json (1)
141-141: LGTM!
| </content> | ||
| </invoke> |
There was a problem hiding this comment.
Remove the stray closing tags at the end of the MDX file.
Mintlify can't parse this page while </content> / </invoke> are present; the broken-links job already fails on this exact syntax error.
🛠️ Proposed fix
-</content>
-</invoke>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| </content> | |
| </invoke> |
🧰 Tools
🪛 GitHub Actions: 📚 Docs Checks / 0_check-broken-links.txt
[error] 155-155: mintlify broken-links failed with a syntax error: Unable to parse file. Unexpected closing slash '/' in tag, expected an open tag first.
🪛 GitHub Actions: 📚 Docs Checks / check-broken-links
[error] 155-155: Mintlify broken-links failed: Syntax error - Unable to parse ai-chat/patterns/ai-sdk-harness.mdx - 155:2-155:3: Unexpected closing slash / in tag, expected an open tag first
Source: Pipeline failures
Show how to run a Vercel AI SDK HarnessAgent (Claude Code/Codex/Pi) inside a chat.agent run(): the harness supplies the agent brain, while chat.agent supplies durable sessions, suspend/resume, and the useChat transport. HarnessAgent.stream() returns a StreamTextResult, so it pipes from run() exactly like streamText.
https://claude.ai/code/session_018PVZy5kT3QcyKixcAF9sSF
Closes #
✅ Checklist
Testing
[Describe the steps you took to test this change]
Changelog
[Short description of what has changed]
Screenshots
[Screenshots]
💯