> This page is for version Dev.
> For other versions, use one of these documentation indexes:
> - Latest (v0.4.0) (default): https://docs.nvidia.com/nemo/switchyard/latest/llms.txt
> - Dev: https://docs.nvidia.com/nemo/switchyard/dev/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/switchyard/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/switchyard/_mcp/server.

# Decision Model-Related Protocols

A decision model evaluates an input against named questions and returns typed
answers. An algorithm can use those answers to choose a model or decide what
work to request next.

Switchyard represents this exchange with
[`DecisionRequest`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionRequest.html)
and
[`DecisionResponse`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionResponse.html).
These are the types exchanged through [`Step::CallDecision`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_libsy/enum.Step.html#variant.CallDecision).

System One is a common API for open decision models, including Jev.
Switchyard supports it alongside OpenAI Decisions through the same protocol.

> **Info**
>
> **Question fields, answer types, and API mappings**
>
> * **[Question reference](/nemo/switchyard/dev/reference/protocols/decision-models/questions):** shared input, question IDs, Boolean/choice/score questions, and provider request mappings.
> * **[Answer reference](/nemo/switchyard/dev/reference/protocols/decision-models/answers):** probabilities, rubric scores, confidence, usage, provider response mappings, and errors.

## Describe the questions \[#describe-the-questions]

One request carries shared input and independent questions keyed by ID.
Each [`DecisionQuestion`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionQuestion.html)
defines what to evaluate and which answer kind to return. The response uses the
same question IDs, so the algorithm can match each answer to its question.

Here is a request asking whether a task contains private information. This is
request construction only; it does not call a provider.

```rust
use std::collections::BTreeMap;
use serde_json::json;
use switchyard_protocol::{DecisionKind, DecisionQuestion, DecisionRequest};

let request = DecisionRequest {
    model: Some("privacy-judge".into()),
    input: json!({"task": "Summarize this customer's account history."}),
    questions: BTreeMap::from([(
        "contains_private_data".into(),
        DecisionQuestion {
            instructions: json!("Does the task contain private customer data?"),
            kind: DecisionKind::Boolean {
                true_description: Some(json!("Contains private customer data")),
                false_description: Some(json!("Contains only public information")),
            },
        },
    )]),
};
```

For required option IDs, rubric levels, and validation responsibilities, see
**[question construction and validation](/nemo/switchyard/dev/reference/protocols/decision-models/questions#construction-and-validation)**.

## Interpret the answers \[#interpret-the-answers]

[`DecisionResponse::answers`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionResponse.html#structfield.answers) maps the same question IDs to [`DecisionAnswer`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionAnswer.html) values.
Each answer separates its typed [`value`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionAnswer.html#structfield.value) from optional [`provider_confidence`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionAnswer.html#structfield.provider_confidence).
For the privacy question, [`ProbabilityTrue(Probability(0.8))`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/enum.BooleanEstimate.html#variant.ProbabilityTrue) means an estimated
0.8 probability that the answer is true. It is not a routing choice until the
algorithm applies its policy. Choice questions can name any supported set of
candidates; their shape is not limited to two models.

The **[answer value reference](/nemo/switchyard/dev/reference/protocols/decision-models/answers#answer-values)**
explains rubric scores, distributions, and the difference between a Boolean
judgment and an answer probability.

## Understand conversion \[#understand-conversion]

**For supported questions and answers, conversion is a direct, lossless mapping
of decision data.** IDs, answer probabilities, rubric positions, and confidence
retain their meanings. Structured values become JSON text where OpenAI requires
strings. This retains their content, rather than making the two wire formats
identical or providing an arbitrary JSON round-trip guarantee.

Both adapters return probabilities for Boolean answers. A custom backend that
returns only true or false can use [`BooleanEstimate::Value`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/enum.BooleanEstimate.html#variant.Value) without inventing
certainty. Optional distributions remain `None` when absent. Both adapters return
[`DecisionValue::Refusal`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/enum.DecisionValue.html#variant.Refusal)
for a question the provider declines to answer. Other answers remain available.

## Own the conversion \[#own-the-conversion]

When handling [`Step::CallDecision`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_libsy/enum.Step.html#variant.CallDecision), use your existing client or a function to
convert [`call.request`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_libsy/struct.CallDecision.html#structfield.request) into the backend's format, send it, and convert the answer
into [`DecisionResponse`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionResponse.html). Pass that work to [`call.respond`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_libsy/struct.CallDecision.html#method.respond) as a future returning
[`libsy::Result<DecisionResponse>`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_libsy/type.Result.html).

Match question IDs and kinds, and retain available distributions and confidence
separately. The
[question reference](/nemo/switchyard/dev/reference/protocols/decision-models/questions#provider-adapters)
links the System One and OpenAI adapter implementations. Decision conversions live in
[`switchyard-llm-client`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_llm_client/); [`switchyard-translation`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_translation/) handles LLM formats.

[`RoutedDecisionClient`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/client/trait.RoutedDecisionClient.html)
is an optional interface that lets Switchyard's clients and execution helpers
work together. Direct [`run_stream`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_libsy/trait.Algorithm.html#method.run_stream) handling does not require implementing it.
See [Mechanics of Libsy](/nemo/switchyard/dev/integrate-switchyard/mechanics-of-libsy#stepcalldecision) for the
call-handling loop and cancellation behavior.

## Use the supplied clients \[#use-the-supplied-clients]

You can instead use the public [`SystemOneClient`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_llm_client/struct.SystemOneClient.html) or [`OpenAiDecisionClient`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_llm_client/struct.OpenAiDecisionClient.html) from
[`switchyard-llm-client`](https://github.com/NVIDIA-NeMo/Switchyard/blob/bc716b420f3f76a77c0e93dde08c14b97ec2120f/crates/libsy-llm-client/README.md). Use dependencies at
the same API revision as libsy and the protocol crate.

This async excerpt sends the earlier `request` to System One. Set its `model` to
an ID served by your endpoint. `SYSTEM_ONE_ENDPOINT` must include `/v1/systemone`.
Running it makes a provider call and may incur a charge.
The trait import makes the supplied client's [`call`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/client/trait.RoutedDecisionClient.html#tymethod.call) method available; you do not
implement a client in this example.

```rust
use std::time::Duration;
use switchyard_llm_client::SystemOneClient;
use switchyard_protocol::RoutedDecisionClient;

let client = SystemOneClient::new(
    std::env::var("SYSTEM_ONE_ENDPOINT")?.parse()?,
    std::env::var("SYSTEM_ONE_API_KEY")?,
    Duration::from_secs(30),
)?;
let response = client.call(request).await?;
```

[`OpenAiDecisionClient::new`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_llm_client/struct.OpenAiDecisionClient.html#method.new) takes the same arguments, with an endpoint ending in
`/v1/decisions` and that provider's key. Each adapter makes one attempt per call;
its timeout covers the request and reading the response body.

For the built-in execution path, register decision clients by model ID with
[`ClientRouter::single_with_decision_clients`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_llm_client/run/struct.ClientRouter.html#method.single_with_decision_clients) or [`new_with_decision_clients`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_llm_client/run/struct.ClientRouter.html#method.new_with_decision_clients), then
use [`switchyard_llm_client::run`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_llm_client/run/fn.run.html). The algorithm still receives the same typed
[`DecisionResponse`](https://nvidia-nemo.github.io/Switchyard/rust/switchyard_protocol/decision/struct.DecisionResponse.html) whichever client performs the call.