Skip to content
Decision tool
Developer documentation/Tools and integrations

Decision tool

Evaluate semantic questions with Jev and branch on probabilities in Dynamic Workflow.

On this pageConfigurationProbability branchesInput and answersCost, authentication and failures

The Rebyte extension { "type": "decision" } exposes rebyte_decide to an Agent and to Dynamic Workflow. It evaluates bounded semantic questions using TypeSafe Jev through Rebyte's LiteLLM Proxy and OpenRouter. Jev is not a conversation model and is not added to the Agent model selector.

Configuration

Include both capabilities to use decisions inside a generated program:

json
{
  "model": "claude-opus-5",
  "tools": [
    { "type": "decision" },
    { "type": "dynamic_workflow" }
  ]
}

Use this configuration when creating a saved Agent or a Session. Session agent.tools overrides replace the full tool list. Without dynamic_workflow, the Agent can still call rebyte_decide directly. Without decision, the tool is unavailable. Neither capability allocates a Session VM.

These are Rebyte extensions. The official OpenAI TypeScript tool union does not include decision; use the SDK's raw post() method or HTTP with Authorization: Bearer <organization-api-key> and OpenAI-Beta: agents=v1.

Probability branches

An Agent can submit this program to run_code:

javascript
async () => {
  const decision = await tools.rebyte_decide({
    state: 'I was charged twice. Please refund the duplicate charge.',
    questions: {
      refund_requested: {
        type: 'noul',
        instructions: 'Is the customer explicitly requesting a refund?',
      },
      team: {
        type: 'choice',
        instructions: 'Which team owns this request?',
        criteria: {
          billing: 'Payments, invoices and refunds',
          technical: 'Software defects and troubleshooting',
        },
      },
      urgency: {
        type: 'score',
        instructions: 'How urgent is the request?',
        criteria: ['Routine', 'Time sensitive', 'Emergency'],
      },
    },
  });

  const p = decision.answers.refund_requested.noul;
  if (p >= 0.9) return { route: 'refund_requested', decision };
  if (p >= 0.8) return { route: 'review', decision };
  return { route: 'no_refund', decision };
}

The program uses the returned number directly. A branch can instead call another configured tool or application function. Application functions follow the usual required_actions handoff. After the application supplies its result, the program resumes using recorded results for earlier completed tool calls.

Test the higher threshold first: p >= 0.9 also satisfies p >= 0.8. These example thresholds are application policy, not a guarantee of model accuracy. The refund question classifies a request; it does not establish refund eligibility or authorize a money transfer.

Input and answers

rebyte_decide accepts exactly state and questions. State is text, a JSON object or an array. Each question has its own ID, type and instructions.

TypeCriteriaAnswer
noulOptional { "true": "...", "false": "..." } descriptionsnoul, a number from 0 to 1 expressing the model's probability of yes
choiceObject containing 2–255 named options and descriptionschoice, probabilities over the options, and confidence
scoreOrdered array of 2–10 descriptionsscore on the zero-based ordinal scale, legend, probabilities, and confidence

The response contains id, the actual upstream model, provider, answers keyed by question ID, and usage with input_tokens, output_tokens, and upstream cost in USD. The route is pinned to typesafe/jev-1.13; the response may identify a dated version of that model.

A direct call publishes a function_call_output Session Item with the same call_id as rebyte_decide. Its JSON output contains the exact Decision response, so your application can read probabilities and usage directly. Inside Dynamic Workflow, use the returned value in your program or pass it to an application function through the usual required_actions handoff.

Rebyte accepts 1–64 questions per call, at most 16,000 characters in each instruction or criterion description, and at most 256 KiB of request JSON. Questions in the same request are evaluated independently against the shared state. Send only the state relevant to these questions. Jev does not generate free-form text, code or arbitrary tool arguments, and is not an arithmetic tool.

confidence is not a calibrated probability that the selected answer is correct. Use the particular answer probability relevant to a branch and evaluate thresholds against your own examples.

Cost, authentication and failures

Decision calls are currently free to Rebyte customers. They neither check nor deduct Rebyte credits. Upstream token usage and cost remain observable; usage.cost is the provider cost, not a customer charge. The Agent's normal language-model calls retain their existing billing and admission checks.

Relay uses an organization-scoped LiteLLM virtual key. The proxy retains authentication and key restrictions, owns the OpenRouter secret, and rejects caller-supplied provider credentials, model overrides and metadata overrides. Upstream OpenRouter balance, rate limits and availability still apply.

Invalid input fails before the upstream request. HTTP errors, malformed answers, unknown options and mismatched question IDs fail explicitly; no fallback model or invented probability is used. Calls have a 30-second Relay deadline and a 25-second proxy upstream deadline. A Dynamic Workflow may catch a tool error; otherwise it receives a failed execution result.

References: OpenRouter Jev, TypeSafe API, TypeSafe confidence, Dynamic Workflow.