All classifiers
ChoiceAgents

Agent tool routing

Choose which tool an assistant should use next, from a fixed list.

Problem

Letting a generative model choose tools freely makes behaviour hard to predict and test. A wrong tool call can expose data or take an action nobody asked for.

Goal

Turn the next step into a typed choice that code can check, log and gate, and ask a clarifying question when the choice is unclear.

Input / state

The latest message, a short summary of the conversation, and the available tools.

latest_message
The user's most recent message.
conversation_summary
What has happened so far, in a few sentences.
available_tools
The tools the signed-in user is allowed to use.

Decision question

ChoiceQuestion key next_tool

Which tool should the support assistant use next to handle `latest_message`?

Options

  • search_help_centerThe user asks how something works or how to do something the help center documents.
  • lookup_orderThe user asks about the status, contents or delivery of a specific order.
  • create_ticketThe user reports a problem that needs a person to investigate or act.
  • no_toolA greeting or thanks, or something that can be answered from the conversation so far.

Allowed outcomes

Decided in your code from the answer and its confidence. Thresholds are yours to set and test.

  • Search help centerChoice is search_help_center and confidence meets your threshold.
  • Look up orderChoice is lookup_order and confidence meets your threshold.
  • Create ticketChoice is create_ticket and confidence meets your threshold.
  • Reply directlyChoice is no_tool and confidence meets your threshold.
  • Ask to clarifyConfidence is below your threshold.

Example scenarios

Predefined demonstrations. No model is called; the outcome shown is an illustrative judgment.

Example state

{
  "latest_message": "How do I export my data to CSV?",
  "conversation_summary": "New conversation.",
  "available_tools": [
    "search_help_center",
    "lookup_order",
    "create_ticket"
  ]
}

Outcome

Illustrative
Search help center

Choice is search_help_center and confidence meets your threshold.

Why

A documented how-to question.

Using it well

  • Arguments that take values from a fixed list can be their own Choice questions. Free-text arguments, such as an order ID, should be extracted and validated in code.
  • Offer only the tools the signed-in user may use, and enforce permissions in the tool, not in the question.
  • Require explicit confirmation for tools with side effects, such as refunds or cancellations.

Request definition

POST https://api.typesafe.ai/v1/systemone
{
  "model": "jev-latest",
  "state": {
    "latest_message": "<latest_message>",
    "conversation_summary": "<conversation_summary>",
    "available_tools": "<available_tools>"
  },
  "questions": {
    "next_tool": {
      "type": "choice",
      "instructions": "Which tool should the support assistant use next to handle `latest_message`?",
      "criteria": {
        "search_help_center": "The user asks how something works or how to do something the help center documents.",
        "lookup_order": "The user asks about the status, contents or delivery of a specific order.",
        "create_ticket": "The user reports a problem that needs a person to investigate or act.",
        "no_tool": "A greeting or thanks, or something that can be answered from the conversation so far."
      }
    }
  }
}

Request shape from the System One API reference; a Kev server accepts the same body. Replace the placeholder state with your data. Requests need your own API key or server.