Agent · intermediate

Agent ルーター

定義済みワークフローから次の Agent または tool を選択します。

choicenoul

使用する場面

  • Multi-agent systems
  • Tool routing
  • Workflow branching

State の例

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

判断の質問

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?

期待される出力

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

この設計の理由

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

注意点

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

公式ソース

2026-09-21

次のステップ: Jev Playgroundテンプレート