Agenci · intermediate

Router Agentów

Wybierz następnego agenta lub tool w ograniczonym workflow.

choicenoul

Kiedy używać

  • Multi-agent systems
  • Tool routing
  • Workflow branching

Przykładowy state

{
  "request": "Check the current rate-limit settings before proposing a change.",
  "current_node": "start",
  "allowed_next": [
    "research_agent",
    "support_agent",
    "ops_agent"
  ]
}

Pytania decyzyjne

choicenext_node

Choose only among the allowed next nodes.

  • research_agent — Research external or background information
  • support_agent — Handle user-support requests
  • ops_agent — Inspect or propose operational configuration changes
  • clarify — 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?

Oczekiwane wyjście

A next-node choice constrained by the current graph and a probability that routing is sufficiently supported.

TypeScript

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?"
    ),
  },
});

Dlaczego to działa

  • 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.

Ograniczenia

  • A routed tool still needs deterministic authorization checks.
  • Never allow model output to create a tool name that is not in the graph.

Oficjalne źródło

2026-09-21

Następny krok: Jev PlaygroundWzorce