Skip to content

docs(advanced): add agent-orchestration page#497

Open
AlemTuzlak wants to merge 3 commits intomainfrom
docs/agent-orchestration
Open

docs(advanced): add agent-orchestration page#497
AlemTuzlak wants to merge 3 commits intomainfrom
docs/agent-orchestration

Conversation

@AlemTuzlak
Copy link
Copy Markdown
Contributor

@AlemTuzlak AlemTuzlak commented Apr 23, 2026

Summary

  • New page docs/advanced/agent-orchestration.md covering multi-agent patterns in TanStack AI: router, handoff, orchestrator + parallel workers + synthesizer, and evaluator / critic loop.
  • Five-invariant "discipline" section: prompt isolation, explicit convergence criteria, structured seams at agent boundaries, cost + latency budgeting, and fail-loud behavior.
  • Worked example: fact-check flow combining router + fan-out + synthesis with Zod-typed seams at every step.
  • Cheat sheet mapping problem → pattern → key risk.
  • Nav entry added to docs/config.json under Advanced.

Test plan

  • Preview the docs site and confirm the new page renders with working mermaid diagrams.
  • Confirm nav entry "Agent Orchestration" appears under Advanced.
  • Sanity-check every code sample uses stream: false for non-streaming calls.
  • Verify cross-links to chat/agentic-cycle, advanced/middleware, advanced/debug-logging, and chat/structured-outputs resolve.

Summary by CodeRabbit

  • Documentation
    • Added an Agent Orchestration guide detailing four multi-agent patterns: intent-based routing, context-preserving handoff, parallel worker fan-out with synthesis, and evaluator-driven refinement loops.
    • Includes operational best practices (prompt isolation, explicit stop/convergence, structured outputs, cost/latency budgeting, and clear error propagation/retry guidance).
    • Provides a consolidated worked example, pattern-selection cheat sheet, and “What’s next” links.

Covers the four multi-agent patterns (router, handoff, orchestrator +
parallel workers + synthesizer, evaluator loop) with code, mermaid
diagrams, and tradeoffs; five invariants that keep multi-agent systems
reliable (prompt isolation, explicit convergence, structured seams,
cost + latency budgeting, fail loud); a worked example combining three
patterns; and a cheat sheet. Adds a nav entry under Advanced.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6743ca65-41b7-42c3-b7ad-92f80a0e0293

📥 Commits

Reviewing files that changed from the base of the PR and between 1bb4624 and 0b7363c.

📒 Files selected for processing (1)
  • docs/config.json
✅ Files skipped from review due to trivial changes (1)
  • docs/config.json

📝 Walkthrough

Walkthrough

Adds a new documentation page that describes four multi-agent orchestration patterns, operational invariants, a worked factCheck example, a cheat sheet, and a navigation entry exposing the page under Advanced.

Changes

Cohort / File(s) Summary
Agent Orchestration Documentation
docs/advanced/agent-orchestration.md
New comprehensive doc explaining intent-based routing, context-preserving handoff, parallel worker execution with synthesis, evaluator-driven refinement, operational invariants (prompt isolation, convergence, typed outputs, budgeting, error propagation), a consolidated factCheck worked example, cheat sheet, and next-steps links.
Docs Navigation
docs/config.json
Adds an "Agent Orchestration" entry under the Advanced section at advanced/agent-orchestration for site navigation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 I hop through pages, neat and brisk,
Four patterns tucked inside my whisk,
Route, hand off, fan out, refine —
A scripted dance in careful line,
A rabbit nods: the doc's divine! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is missing required sections from the template. The 'Changes' section is omitted entirely, and only the 'Test plan' is provided without a proper 'Checklist' section with required task verification. Add a 'Changes' section explaining the motivation for the new documentation. Include the full 'Checklist' section with boxes marked as completed or indicate docs/CI/dev-only status under 'Release Impact'.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs(advanced): add agent-orchestration page' clearly and concisely summarizes the main change—adding a new documentation page for agent orchestration patterns under the advanced 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/agent-orchestration

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

🚀 Changeset Version Preview

11 package(s) bumped directly, 22 bumped as dependents.

🟥 Major bumps

Package Version Reason
@tanstack/ai-fal 0.6.17 → 1.0.0 Changeset
@tanstack/ai-gemini 0.9.1 → 1.0.0 Changeset
@tanstack/ai-grok 0.6.8 → 1.0.0 Changeset
@tanstack/ai-openai 0.8.1 → 1.0.0 Changeset
@tanstack/ai-openrouter 0.8.1 → 1.0.0 Changeset
@tanstack/ai-react 0.7.15 → 1.0.0 Changeset
@tanstack/ai-solid 0.6.19 → 1.0.0 Changeset
@tanstack/ai-svelte 0.6.19 → 1.0.0 Changeset
@tanstack/ai-vue 0.6.19 → 1.0.0 Changeset
@tanstack/ai-anthropic 0.8.1 → 1.0.0 Dependent
@tanstack/ai-code-mode 0.1.7 → 1.0.0 Dependent
@tanstack/ai-code-mode-skills 0.1.7 → 1.0.0 Dependent
@tanstack/ai-elevenlabs 0.1.7 → 1.0.0 Dependent
@tanstack/ai-event-client 0.2.7 → 1.0.0 Dependent
@tanstack/ai-groq 0.1.7 → 1.0.0 Dependent
@tanstack/ai-isolate-node 0.1.7 → 1.0.0 Dependent
@tanstack/ai-isolate-quickjs 0.1.7 → 1.0.0 Dependent
@tanstack/ai-ollama 0.6.9 → 1.0.0 Dependent
@tanstack/ai-preact 0.6.19 → 1.0.0 Dependent
@tanstack/ai-react-ui 0.6.1 → 1.0.0 Dependent
@tanstack/ai-solid-ui 0.6.1 → 1.0.0 Dependent

🟨 Minor bumps

Package Version Reason
@tanstack/ai 0.13.0 → 0.14.0 Changeset
@tanstack/ai-client 0.7.14 → 0.8.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/ai-code-mode-models-eval 0.0.10 → 0.0.11 Dependent
@tanstack/ai-devtools-core 0.3.24 → 0.3.25 Dependent
@tanstack/ai-isolate-cloudflare 0.1.7 → 0.1.8 Dependent
@tanstack/ai-vue-ui 0.1.30 → 0.1.31 Dependent
@tanstack/preact-ai-devtools 0.1.28 → 0.1.29 Dependent
@tanstack/react-ai-devtools 0.2.28 → 0.2.29 Dependent
@tanstack/solid-ai-devtools 0.2.28 → 0.2.29 Dependent
ts-svelte-chat 0.1.36 → 0.1.37 Dependent
ts-vue-chat 0.1.36 → 0.1.37 Dependent
vanilla-chat 0.0.34 → 0.0.35 Dependent

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 23, 2026

View your CI Pipeline Execution ↗ for commit 0b7363c

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-24 09:44:56 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 23, 2026

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@497

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@497

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@497

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@497

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@497

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@497

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@497

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@497

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@497

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@497

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@497

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@497

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@497

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@497

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@497

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@497

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@497

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@497

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@497

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@497

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@497

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@497

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@497

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@497

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@497

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@497

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@497

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@497

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@497

commit: 0b7363c

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

♻️ Duplicate comments (1)
docs/advanced/agent-orchestration.md (1)

218-221: ⚠️ Potential issue | 🟡 Minor

Use .describe() instead of .meta() for schema descriptions.

Same issue as in the Router pattern. The Verdict schema should use .describe() for the feedback field description:

🔧 Proposed fix
 const Verdict = z.object({
   accepted: z.boolean(),
-  feedback: z.string().meta({ description: "Required if accepted is false" }),
+  feedback: z.string().describe("Required if accepted is false"),
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/advanced/agent-orchestration.md` around lines 218 - 221, The Verdict Zod
schema uses .meta() for the feedback field description; update the schema so the
feedback property uses .describe("Required if accepted is false") instead of
.meta(...). Locate the Verdict constant and replace the feedback field's
z.string().meta({ description: "Required if accepted is false" }) with
z.string().describe("Required if accepted is false") so the schema description
follows the Router pattern and Zod conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/advanced/agent-orchestration.md`:
- Around line 54-57: Replace the use of Zod's .meta({ description: ... }) on the
Route schema with .describe(...) so the schema description is attached in the
standard Zod way; specifically update the Route constant (const Route =
z.object({...})) to call .describe("One sentence justifying the choice") on the
reason field (and any other fields using .meta({ description: ... })) so
descriptions appear correctly in JSON Schema output and LLM consumption.

---

Duplicate comments:
In `@docs/advanced/agent-orchestration.md`:
- Around line 218-221: The Verdict Zod schema uses .meta() for the feedback
field description; update the schema so the feedback property uses
.describe("Required if accepted is false") instead of .meta(...). Locate the
Verdict constant and replace the feedback field's z.string().meta({ description:
"Required if accepted is false" }) with z.string().describe("Required if
accepted is false") so the schema description follows the Router pattern and Zod
conventions.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1dd14b8b-e9d7-4f78-a020-2bbaab827e35

📥 Commits

Reviewing files that changed from the base of the PR and between 54523f5 and fd9788d.

📒 Files selected for processing (2)
  • docs/advanced/agent-orchestration.md
  • docs/config.json

Comment on lines +54 to +57
const Route = z.object({
intent: z.enum(["billing", "technical", "refund"]),
reason: z.string().meta({ description: "One sentence justifying the choice" }),
});
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 | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for existing Zod schema patterns in the codebase
rg -n -C2 '\.describe\(' --type=ts
rg -n -C2 '\.meta\(' --type=ts

Repository: TanStack/ai

Length of output: 50368


🌐 Web query:

What is the correct Zod method for adding descriptions to schema fields that will appear in JSON Schema output?

💡 Result:

The correct Zod method for adding descriptions to schema fields that appear in JSON Schema output (via z.toJSONSchema) is .describe(description), a shorthand that sets a description field in the schema's metadata registered in z.globalRegistry. Both .describe("Your description") and .meta({ description: "Your description" }) work, with .describe being simpler for descriptions. Metadata is automatically included in the JSON Schema output. Important notes: - Call .describe or .meta last in the method chain, as subsequent methods (e.g., .min, .extend) create new schema instances without inheriting metadata. - Example: import { z } from "zod"; const schema = z.object({ name: z.string.min(1).describe("The person's name"), age: z.number.int.describe("Age in years"), }); const jsonSchema = z.toJSONSchema(schema); // Outputs JSON Schema with "description" fields for name and age This is supported in Zod v4 (current stable version as of 2026), where native JSON Schema conversion was introduced.

Citations:


Use .describe() instead of .meta() for Zod schema descriptions.

The .describe() method is the standard Zod approach for adding descriptions to schema fields. When descriptions need to appear in JSON Schema output (especially for LLM consumption), use .describe() rather than .meta({ description: "..." }).

🔧 Proposed fix
 const Route = z.object({
   intent: z.enum(["billing", "technical", "refund"]),
-  reason: z.string().meta({ description: "One sentence justifying the choice" }),
+  reason: z.string().describe("One sentence justifying the choice"),
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/advanced/agent-orchestration.md` around lines 54 - 57, Replace the use
of Zod's .meta({ description: ... }) on the Route schema with .describe(...) so
the schema description is attached in the standard Zod way; specifically update
the Route constant (const Route = z.object({...})) to call .describe("One
sentence justifying the choice") on the reason field (and any other fields using
.meta({ description: ... })) so descriptions appear correctly in JSON Schema
output and LLM consumption.

The router snippet referenced `specialists[decision.intent]` without
defining specialists, leaving readers to guess at the dispatch target.
Inline a concise declaration showing each specialist as its own chat()
call with a dedicated system prompt.
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