Skip to main content
How Co-Admin decides whether to call live data tools, product documentation search, or answer from general knowledge — and how to avoid common routing mistakes.

Three intent classes

Classification runs in classifyCoAdminIntent (backend) and a lighter buildRoutingHint (frontend chat route). Hints are injected into the system prompt — the model may still choose tools, but hints reduce wrong paths.

Live data patterns (→ tools, not docs)

Trigger examples: Regex-style signals (backend): my/our workspace, how many + channels/webhooks/threads/agents, unread, delivery/delivered/read rate/sent/failed, analytics/performance/metrics, contact + email/phone. Rule: Never invent counts. If tools return empty or zero, state that explicitly.

Product docs patterns (→ search_product_docs)

Trigger examples: Regex-style signals: how do/to, what is, setup/configure, vendschat + feature words, ai agent, broadcast, template, webhook, billing, plan, industry + help. Rule: Do not call search_product_docs for “how many channels do I have?” — that is live data.

Mixed questions (use multiple tools in one turn)

Maximum 6 tool steps per message — prioritize the user’s primary ask if the budget is tight.

Disambiguation guide

“Agents” — which kind?

“Analytics” — Co-Admin tool vs dashboard

“Contacts” vs “team members”

“Campaigns” / “broadcasts”


Frontend routing hints (chat API)

The Next.js route /api/agent/chat adds a hint from the latest user message only: Backend buildRoutingSystemHint uses the fuller classifyCoAdminIntent patterns for services that call the router directly.

Answering when tools return empty


What Co-Admin should not route to tools


Training examples (input → expected behavior)