Skip to content

docs: add AI SDK harness agent pattern for chat.agent#3940

Draft
ericallam wants to merge 1 commit into
mainfrom
claude/slack-session-i84r19
Draft

docs: add AI SDK harness agent pattern for chat.agent#3940
ericallam wants to merge 1 commit into
mainfrom
claude/slack-session-i84r19

Conversation

@ericallam

Copy link
Copy Markdown
Member

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

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

[Describe the steps you took to test this change]


Changelog

[Short description of what has changed]


Screenshots

[Screenshots]

💯

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
@mintlify

mintlify Bot commented Jun 13, 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 13, 2026, 5:09 PM

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

@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 04046d0

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 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds a new documentation page explaining how to integrate Vercel AI SDK HarnessAgent runtimes within chat.agent. The guide covers the architectural separation between the two abstractions, provides a minimal implementation example with Claude Code, explains how to swap different harness adapters, describes why this pattern supports multi-turn persistence and recovery, includes lifecycle management patterns, compares capabilities across layers, and offers guidance on when to use this combination. The documentation page is registered in the navigation configuration file.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description provides context about the feature but lacks completion of required template sections like testing, changelog, and has unchecked checklist items. Complete the Testing and Changelog sections with actual content, check the applicable checklist boxes, and fill in or remove the Screenshots section if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding documentation for the AI SDK harness agent pattern within chat.agent.
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 claude/slack-session-i84r19

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 361f5378-e599-43f6-8c88-e936e1484f0f

📥 Commits

Reviewing files that changed from the base of the PR and between 034058b and 04046d0.

📒 Files selected for processing (2)
  • docs/ai-chat/patterns/ai-sdk-harness.mdx
  • docs/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 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,ts,tsx,jsx,css,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier for code formatting and run pnpm run format before 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/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/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!

Comment on lines +155 to +156
</content>
</invoke>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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.

Suggested change
</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

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