Skip to content
Christian Pojoni edited this page May 2, 2026 · 2 revisions

tanstack-ai-subagents

Reusable subagent routing and execution helpers for TanStack AI apps.

This package is built around one production opinion: finite subagent routing should be deterministic by default. If the possible outputs are known — answer directly, use tools, write a plan, spawn one specialist, spawn multiple specialists, or refuse/escalate — routing is classification, not a task that needs another LLM call.

What it provides

  • Score-based intent routing with routeSubagentRequest(...)
  • App-configurable routing policies with createSubagentRouter(...)
  • TanStack AI tool factories for route_subagents and run_subagents
  • Bounded worker validation and fanout
  • App-defined tools, profiles, models, prompts, tracing, persistence, and UI
  • Lifecycle callbacks and background run handles

Install

npm install @5queezer/tanstack-ai-subagents @tanstack/ai zod

@tanstack/ai and zod are peer dependencies.

Quick proof

Verified on commit 7cf49a3:

npm test
# 12 tests, 12 pass

npm pack --dry-run
# includes dist/, README.md, LICENSE, and demo/routing-in-action.cast

Pages

Source

Clone this wiki locally