Skip to content

Agent team (router)

The Agent team (router) lets you run several specialist agents in a single chat — for example Sales, Workshop and Admin — instead of one agent that must know everything. One agent answers by default and, when the user’s request belongs to another area, it hands off to the right specialist. The user never loses the thread: everyone shares the same conversation and memory; each one answers with its own context (its system prompt, its RAG and its tools).

The answering agent is offered, on top of its own tools, some handoff tools (one per teammate). When the model detects the topic is not its own, it calls the matching handoff; the router switches agents and answers the same message again with the right specialist (a real answer, not a “transferring you”). The active agent is remembered across messages until another handoff happens. There’s a cap on hops per turn to avoid infinite bouncing.

telegramReceive → Agent team (router) → telegram (send)

The specialist AI Agents live in the same workflow but loose (not wired into the flow), just like the Brain/RAG/Tools nodes. The router discovers them on its own.

FieldTypeRequiredDescription
inputtextNoUser message. If empty, uses data.content / data.message from the channel trigger.
session_keytextNoKey to isolate memory per user. On Telegram use `{{data.chatId}}`; on WhatsApp the phone number. If empty, derived from the channel automatically.
default_agenttextNoAlias of the default AI Agent. If empty, the one flagged “Default agent” or the first one is used.

Output: data.reply (and data.response) with the answer, data.agent (which specialist answered) and data.session_id.

Each AI Agent in the team is configured as usual (its brain, RAG and tools), plus three fields that define its role in the team:

FieldPurpose
Agent nameHow it’s referred to on handoff, e.g. Sales, Workshop, Admin.
Purpose / when to useWhen this agent should handle the chat. This is what the others read to decide the handoff, e.g. “invoices, payments and tax data”.
Default agentFlag only one per team: the one that answers first.
  1. Build the channel workflow: telegramReceive → Agent team (router) → telegram.
  2. On the router, session_key: `{{data.chatId}}` (so each customer gets their own memory).
  3. Add three loose AI Agents, each with its Brain:
    • Sales — Purpose: “advice and selling of projects”. Flag it as Default agent.
    • Workshop — Purpose: “repair status, appointments and technical support”.
    • Admin — Purpose: “invoices, payments, tax data”.
  4. (Optional) Wire a RAG with the catalog to Sales, and their tools to the others.

Result: the customer writes and Sales attends. If they ask “can you send me this month’s invoice?”, Sales hands off to Admin, which answers and keeps attending until the topic changes again.

  • Everyone shares memory / users get mixed up: session_key is missing. Set it to `{{data.chatId}}` (Telegram) or the phone number (WhatsApp).
  • It never hands off: check each specialist’s Purpose; if they’re empty or vague, the model can’t tell when to hand off.
  • It hands off too much: tune the Purposes so they don’t overlap, and reinforce in each system prompt that it should answer only about its area.
  • Credential error on handoff: the receiving specialist also needs its Brain with the client’s credential.