function subagentRoute<TAgents>(agents, options?): object;
Defined in: packages/ai/src/activities/chat/agents/route.ts:53
Build decide() questions for a subagent router.
One yes/no question per agent, plus an order choice.
pick returns main, one name, { names, order }, or { steps }.
Names follow the agents array order.
{ names, order } overrides subagents.order for that turn.
then: agents that run after the other selected agents. The lead group
starts together. The then agents then run one after another in list
order, and each reads the text so far. Used only when the router picks at
least one agent from each group. Otherwise pick returns { names, order }.
Type Parameters#
TAgents#
TAgents extends readonly DefinedAgent<string, readonly SubagentTool[], SchemaInput | undefined, readonly InterruptDefinition<any, any, any, any, any>[]>[]
Parameters#
agents#
TAgents
options?#
SubagentRouteOptions<TAgents>
Returns#
object
pick#
pick: (result) => SubagentRouterPick;
Parameters#
result#
RouteAnswers<TAgents>
Returns#
questions#
questions: RouteQuestions<TAgents>;