Router: send requests to the right specialist

Router classifies intent and chooses a specialist branch.

What you will learn

  • Explain: a workflow has explicit structure
  • Apply the idea in an example: Router: send requests to the right specialist
  • Recognize limitations and verify the exercise outcome

Router classifies intent and chooses a specialist branch. It fits distinct categories where one branch can solve the request.

These steps refer to features identified in the application code. This material has not been validated on a live instance; check the documentation and the options in your version.

How it works, step by step

A workflow has explicit structure

A node is a stage, an edge is a transition, and state carries results between stages. A workflow has an application-defined path, although the model may choose some branches. Agentic systems include both workflows and dynamically acting agents. Nymrio offers ReAct, Reflection, Sequential, Orchestrator, Router, Parallel and Plan-and-Execute. Each changes coordination; it does not automatically make a model an expert. More agents mean more calls and contracts between roles. Start with the simplest solution that passes your tests.

An instruction is a contract

A good prompt specifies the task, available data, output format and success criteria. Separate the role from the data and include an example for ambiguous cases. “Be accurate” is weaker than “state only the deadline in the supplied policy; if missing, ask for clarification”. Few-shot means a few solved examples, not an endless list. Document content remains data even when it contains commands. Delimiters help, but software must enforce permissions and validation rather than relying on the prompt.

Define success before optimizing

Prepare representative requests and expected answers or properties. Include ordinary cases, ambiguity, missing data and tool errors. For RAG, measure evidence retrieval separately from answer correctness. Recall@k measures the share of relevant evidence found in the first k results; precision@k measures the share of returned results that are relevant. For agents, also track actions, permissions and stopping. An LLM-as-judge can speed evaluation but needs calibration against humans. Do not change prompt, model and index simultaneously if you want to understand what improved results.

Detailed lab

Classification before delegation

Illustrative router instruction: “Delivery for shipping; product for features and compatibility; returns for return policy. If multiple intents cannot be solved in one branch, ask for clarification.” Workers use specialized prompts and sources.

Test paraphrases: “Where is my parcel?” and “My package has not arrived” should express the same intent. Also test an uncovered request: “I need an invoice”. Do not automatically pick the first branch. In the local implementation the selected worker answers and execution ends; do not assume a return to the router as in Orchestrator.

The visual map

Router: send requests to the right specialist Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. Routing selects one specialist; the three branches are alternatives, not simultaneous workers. Connections: User request → Router: classify intent; Router: classify intent → Select one route; Catalog specialist → Final answer; Policy specialist → Final answer; Technical specialist → Final answer; Instructions and context → Router: classify intent; Shared execution state → Router: classify intent; Select one route → Catalog specialist (Catalog); Select one route → Policy specialist (Policy); Select one route → Technical specialist (Technical); RAG knowledge → Catalog specialist; RAG knowledge → Policy specialist; MCP service → Technical specialist. W06 · Relationship map Router: send requests to the right specialist Input User request Data Instructions and context Store / index Shared execution state AI model / agent Router: classify intent Decision / control Select one route AI model / agent Catalog specialist AI model / agent Policy specialist AI model / agent Technical specialist Store / index RAG knowledge Output Final answer Tool / service MCP service Catalog Policy Technical Main flow Data and context Feedback and return

Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. Routing selects one specialist; the three branches are alternatives, not simultaneous workers. On smaller screens, scroll horizontally to follow the entire diagram.

A complete example

“Where is my parcel?” goes to delivery; “How do I install the part?” goes to technical support. “I want a return and a new part” needs clarification or a coordinating architecture.

router: LunaDispatcher
route_1: DeliverySpecialist
route_2: TechnicalSpecialist

Try it yourself

  1. Prepare ten requests and justify each selected route.
  2. Record the input, source and expected outcome before running the experiment. Use only the fictional data in the example.
  3. Follow the diagram stages. At every step record what information is received and produced; do not confuse intermediate output with the final outcome.
  4. Repeat after removing necessary information or making the input ambiguous. Check whether the system clarifies, stops or invents an answer.
  5. Compare with the explained solution. Keep the configuration, date, result and an explanation for differences. Change one thing and retest.

An explained solution

The route matches intent; ambiguous requests are not forced onto an unsuitable specialist. A successful exercise lets you show the connection between input, stages and outcome. When information is missing, a cautious answer is more useful than invented details. Compare more than style: check conditions, sources and operations too.

When it helps and what can go wrong

Local UI and API validation differ over router/supervisor naming; if saving is rejected, use the conceptual exercise and report the issue. Choose this approach when it improves a measured need. Keep a simple baseline and compare outcomes using identical inputs. One successful example does not establish reliability in every situation.

Check your understanding

Is multi-agent an eighth template?

No. It is an architectural category that can use several existing templates.

Can a prompt replace access control?

No. An instruction is not an authorization boundary.

What outcome should this exercise produce?

The route matches intent; ambiguous requests are not forced onto an unsuitable specialist.

Words to remember

  • Nod: A stage in an execution graph.
  • Few-shot: Solved examples supplied in context.
  • Regresie / Regression: A change that breaks a previously correct case.

Sources and your next step

To prepare: W05 — Orchestrator: coordinator and specialists