agents · intermediate
Agent Router
Choose the next allowed agent or tool from a constrained graph without treating the model's choice as authorization.
choicenoul
When to use it
- Multi-agent systems
- Tool routing
- Workflow branching
Example state
{
"request": "Check the current rate-limit settings before proposing a change.",
"current_node": "start",
"allowed_next": [
"research_agent",
"support_agent",
"ops_agent"
]
}Decision questions
choicenext_node
Choose only among the allowed next nodes.
research_agent— Research external or background informationsupport_agent— Handle user-support requestsops_agent— Inspect or propose operational configuration changesclarify— Not enough information to route safely
noulenough_information
Is there enough information in the request and current graph state to choose a next node safely?
Expected structured output
A next-node choice constrained by the current graph and a probability that routing is sufficiently supported.
TypeScript example
import { choice, noul, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient();
const result = await client.systemOne({
state: {
request: "Check the current rate-limit settings before proposing a change.",
current_node: "start",
allowed_next: ["research_agent", "support_agent", "ops_agent"],
},
questions: {
next_node: choice("Choose only among the allowed next nodes.", {
research_agent: "Research background information",
support_agent: "Handle user-support requests",
ops_agent: "Inspect or propose operational configuration changes",
clarify: "Not enough information to route safely",
}),
enough_information: noul(
"Is there enough information to choose a next node safely?"
),
},
});Why this design works
- The candidate set comes from the workflow graph, not from unconstrained model invention.
- The application remains responsible for permissions and execution.
- Clarification is a first-class outcome.
Limits and boundaries
- A routed tool still needs deterministic authorization checks.
- Never allow model output to create a tool name that is not in the graph.
Sources and inspiration
Continue
Browse all templates, learn the official SDK shape, or estimate production volume with the cost calculator.