Skip to main content

Decisions

Preview

This feature is currently in preview. Its behaviour, and the request and response shapes described here, may change.

Introduction​

Decisions evaluates an input against a list of typed questions and returns a probability-based answer for each one. Use it to classify, route, score or check content without building an agent or writing a prompt.

Each question has one of three types:

TypeWhat it asksWhat you get back
PredicateIs a condition true? For example, is this message a complaint?The probability that the condition is true.
ChoiceWhich of several values applies? For example, which department should handle this ticket?The chosen value, the probability of each option and a confidence.
ScoreWhere does the input fall on an ordered scale? For example, how urgent is this request?A rating against your levels, the probability of each level and a confidence.

The input can be plain text, a conversation with images, or a full agent trace including its tool calls, depending on the model you choose (see Selecting the model). That makes Decisions useful for evaluating your own agents against a policy as well.

Because every answer carries probabilities, you decide where to draw the line. For example, you could route a ticket automatically only when the confidence is above 0.8, and send it for human review otherwise.


Try it in the playground​

The fastest way to experiment is the Decisions playground. You can try questions against your own inputs, inspect the answers, and copy a ready-to-run cURL command when you're happy with the result.

  1. In the Serenity* Star sidebar, under Workspace, select AI Services.

    The Serenity* Star sidebar with AI Services selected under Workspace

  2. In Inference & Embeddings Services, open the Decisions card. You can also go straight to AI Services > Decisions.

    The AI Services page with its Image, Audio and Inference & Embeddings Services sections, and the Decisions card highlighted next to Embedding Generation and Inference

  3. In Selected model, keep the default model (Orion Compass 26.1) or select Choose another model to pick any other decision model available to your organisation.

  4. In Sample, select Change to load one of the preset request bodies: Predicate, Choice, Score, All types, Image or Agent evaluation. They are the same requests shown in Examples. The Image and Agent evaluation samples need a model that accepts images and full conversations, such as GPT-6 Luna Decisions, so select it first.

  5. Edit the JSON in Request Body to try your own input and questions. Use Format to tidy it up and Copy to copy it. The selected model is filled into the body for you.

  6. Click Execute.

The Execution Result panel on the right shows one card per question with its answer (the probability that a predicate is true, the chosen value of a choice, or the level of a score) together with the probabilities and confidence. Select Metadata to see the execution's usage and cost.

The Decisions playground: on the left, Orion Compass 26.1 selected and the All types sample in the request body; on the right, the Execution Result with a predicate probability, a choice answer with the probability of each value, and a score with the probability of each level

Code snippet​

Select Code Snippet to get a cURL command that mirrors the request body you have set, ready to run from your terminal or adapt to your own code. The API key is masked by default; select the eye icon (Show API key) to include your organisation's AI Service Execution key in the command.

The Code snippet panel with a cURL command for the Predicate sample and the API key masked

Instances and cost​

On the AI Services page, the icons at the bottom of the Decisions card open the Instances and Cost & Usage views. Both views need administrator or cost administrator access.

The Decisions card on the AI Services page, with the View Instances and View Cost & Usage icons at the bottom highlighted

  • View Instances lists your Decisions executions within your plan's log retention period, whether they came from the playground or the API, with their date, model, cost, token usage, user identifier and channel. The tiles at the top show the totals.

    The Decisions Instances view, with totals for instances, tokens and cost above a grid of the latest executions from the API and the playground

  • View Cost & Usage shows what Decisions has cost by month and period, plus daily spend charts per model, per AI service and per channel. See Cost Dashboard & Tracking.

    The Decisions Cost & Usage view, with the Cost Analysis totals per period and the Daily spend per model chart for the last 30 days


Using the API​

This section is for developers calling Decisions from their own applications.

Authentication​

Send your API key in the X-API-KEY header on every request. To get a key, do one of the following:

  • Create one in Developer Tools › Api Keys › New key, with Global scope and the AI Service Execution role.
  • Reveal your organisation's AI Service Execution key from the playground's Code Snippet panel.
Keep your API key secret

Call the API from your backend, never from browser or mobile code. Don't commit keys to source control or paste them into tickets or chats. If a key leaks, revoke it in Developer Tools › Api Keys and create a new one.

Endpoint​

POST https://api.serenitystar.ai/api/v2/decisions
Content-Type: application/json
X-API-KEY: <your-api-key>

Request body​

FieldTypeRequiredDescription
vendorstringOne way to pick the modelThe model's vendor, for example SerenityCloud. Use it together with modelCode.
modelCodestringOne way to pick the modelThe model's code, for example orion-compass-26.1. Use it together with vendor.
aiModelIdstring (GUID)The other way to pick the modelThe model's id. Send either aiModelId or vendor + modelCode, not both.
inputstring or arrayYesWhat the questions are evaluated against: plain text, or an array of input items (see Input items).
questionsarrayYesThe questions to answer about the input, at least one (see Questions).
userIdentifierstringNoYour identifier for the end user, for tracking and cost reporting. Use an opaque id, not an email address or a name.
channelstringNoA label for where the call came from. Defaults to API.

Selecting the model​

These are the decision models you can select with vendor + modelCode:

ModelvendormodelCodeInput it accepts
Orion Compass 26.1 (default in the playground)SerenityCloudorion-compass-26.1Text in user messages
Orion Compass Flash 26.1SerenityCloudorion-compass-flash-26.1Text in user messages
GPT-6 Luna DecisionsOpenAIgpt-6-lunaText, images, full conversations and agent traces with tool calls

The playground's model selector lists every decision model available to your organisation. You can also browse the Available AI Models catalog, where decision models are marked with the Decisions badge, to see the latest ones. If you send input the model doesn't accept, such as an image to an Orion Compass model, the request fails with a 400 aiservice_execution_failed error.

Questions​

Every question has a type, a name and instructions. Choice and score questions also take their options.

FieldApplies toDescription
typeAllpredicate, choice or score.
nameAllIdentifies the answer in the response. Must be unique within the request.
instructionsAllWhat the model should evaluate about the input, phrased as a question.
choiceschoice onlyAt least two options, each with a unique value and an optional description of when it applies.
levelsscore onlyAt least two levels, ordered from lowest to highest, each with a label and an optional description.
Writing good questions
  • A short description on a choice or level helps the model when the value alone is ambiguous.
  • You can send several questions in one request, in any mix of types. They are all evaluated against the same input, and the answers come back in question order.

Input items​

input can be a plain string. To send a conversation, images or an agent trace, send an array of items instead, using a model that accepts them (see Selecting the model). The items follow the shape of OpenAI's Responses API input.

Item typeFieldsDescription
message (the default when type is omitted)role, content, optional phaseA message from system, developer, user or assistant. content is a string or an array of content parts. phase (commentary or final_answer) applies to assistant messages.
function_callcallId, name, argumentsA tool call the agent made. arguments is a string, usually JSON, and is passed to the model as is.
function_call_outputcallId, outputThe result of a tool call, matched to its function_call by callId. output is a string or an array of input_text / input_image parts.
note

Function calls are evidence only. Nothing is executed: the model reads the calls and their outputs to answer your questions.

Content parts​
Part typeFieldsAllowed in
input_texttextuser, developer and system messages; function call outputs
input_imageimageUrl, optional detail (low, high, auto or original)user messages; function call outputs
output_texttextassistant messages
refusalrefusalassistant messages

Images must be sent as base64 data URLs, such as data:image/png;base64,iVBORw0…, with no line breaks in the base64 data. HTTP(S) image URLs are not accepted.

Limits​

The limits on input length and number of questions depend on the model. A request over the model's limits fails with a 400 aiservice_execution_failed error that includes the model provider's message.

Response​

{
"instanceId": "8f6c2a1e-3b7d-4c55-9a0e-2d4f6b8c1a90",
"answers": [ … ],
"usage": { "inputUnit": "tokens", "input": 58, "outputUnit": "tokens", "output": 1 },
"cost": { "amount": 0.0000058, "currency": "USD" }
}
FieldDescription
instanceIdThe id of this execution. It is also shown in the Decisions Instances view.
answersOne answer per question, in the same order as questions.
usageThe billed quantities and their units.
costThe cost of this execution, in your organisation's currency.

Answers​

Each answer has the question's type and name, plus the fields for its type. All probabilities and confidences range from 0 to 1.

typeFields
predicateprobability: how likely the condition is to be true.
choicechoice: the selected value. probabilities: each value with its probability. confidence: the model's confidence in the answer.
scorescore: the probability-weighted average of the level indices (0 for the first level, 1 for the second, and so on), so it can fall between two levels. probabilities: each level index (value) with its label and probability. confidence: the model's confidence in the answer.
refusalNo extra fields. The model declined to answer this question. Other questions in the same request can still be answered.

Examples​

These are the playground's samples, so you can load any of them from Sample and run it straight away. They use Orion Compass 26.1, except Image and Agent evaluation, which use GPT-6 Luna Decisions because they send images and full conversations. Replace <your-api-key> with your key.

Response values are illustrative and will vary with the model and input.

Predicate: is a condition true?​

cURL
curl -X POST "https://api.serenitystar.ai/api/v2/decisions" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <your-api-key>" \
-d '{
"vendor": "SerenityCloud",
"modelCode": "orion-compass-26.1",
"input": "Heavy snow closed the mountain pass overnight. Crews expect to reopen it by midday, and trains on the valley line are running normally.",
"questions": [
{
"type": "predicate",
"name": "is_travel_disruption",
"instructions": "Does the text report a disruption to travel?"
}
]
}'

Example response:

{
"instanceId": "8f6c2a1e-3b7d-4c55-9a0e-2d4f6b8c1a90",
"answers": [
{ "type": "predicate", "name": "is_travel_disruption", "probability": 0.91 }
],
"usage": { "inputUnit": "tokens", "input": 64, "outputUnit": "tokens", "output": 1 },
"cost": { "amount": 0.0000064, "currency": "USD" }
}

Choice: pick one of several values​

cURL
curl -X POST "https://api.serenitystar.ai/api/v2/decisions" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <your-api-key>" \
-d '{
"vendor": "SerenityCloud",
"modelCode": "orion-compass-26.1",
"input": "Astronomers detect water vapour in the atmosphere of a planet 120 light-years from Earth.",
"questions": [
{
"type": "choice",
"name": "topic",
"instructions": "Which section of a newspaper does this headline belong to?",
"choices": [
{ "value": "science", "description": "Research, space, health and the environment." },
{ "value": "politics", "description": "Government, elections and public policy." },
{ "value": "sports" },
{ "value": "culture", "description": "Film, music, books and the arts." }
]
}
]
}'

Example response:

{
"instanceId": "1d0b7e52-6a3f-4f0e-8c1b-7e9a2d4c6f10",
"answers": [
{
"type": "choice",
"name": "topic",
"choice": "science",
"probabilities": [
{ "value": "science", "probability": 0.97 },
{ "value": "politics", "probability": 0.01 },
{ "value": "sports", "probability": 0.0 },
{ "value": "culture", "probability": 0.02 }
],
"confidence": 0.97
}
],
"usage": { … },
"cost": { … }
}

Score: rate against ordered levels​

cURL
curl -X POST "https://api.serenitystar.ai/api/v2/decisions" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <your-api-key>" \
-d '{
"vendor": "SerenityCloud",
"modelCode": "orion-compass-26.1",
"input": "A 14 km loop with 900 m of climbing, a short exposed scramble near the summit and no water sources after the first hour.",
"questions": [
{
"type": "score",
"name": "difficulty",
"instructions": "How difficult is this hiking route for an average walker?",
"levels": [
{ "label": "easy" },
{ "label": "moderate" },
{ "label": "hard" },
{ "label": "expert", "description": "Needs climbing skills or specialist equipment." }
]
}
]
}'

Example response. A score of 1.9 means the answer is close to level 2, hard:

{
"instanceId": "5c9e1f30-2b4a-4d6e-9f71-0a3b8c2d5e47",
"answers": [
{
"type": "score",
"name": "difficulty",
"score": 1.9,
"probabilities": [
{ "value": 0, "label": "easy", "probability": 0.0 },
{ "value": 1, "label": "moderate", "probability": 0.18 },
{ "value": 2, "label": "hard", "probability": 0.74 },
{ "value": 3, "label": "expert", "probability": 0.08 }
],
"confidence": 0.74
}
],
"usage": { … },
"cost": { … }
}

All types: several questions about the same input​

cURL
curl -X POST "https://api.serenitystar.ai/api/v2/decisions" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <your-api-key>" \
-d '{
"vendor": "SerenityCloud",
"modelCode": "orion-compass-26.1",
"input": "The visuals are stunning and the soundtrack is unforgettable, but the plot falls apart in the last twenty minutes.",
"questions": [
{
"type": "predicate",
"name": "recommends_film",
"instructions": "Would the reviewer recommend the film?"
},
{
"type": "choice",
"name": "strongest_aspect",
"instructions": "Which aspect of the film does the reviewer praise most?",
"choices": [
{ "value": "visuals" },
{ "value": "plot" },
{ "value": "acting" },
{ "value": "music" }
]
},
{
"type": "score",
"name": "sentiment",
"instructions": "How positive is the review overall?",
"levels": [
{ "label": "negative" },
{ "label": "mixed" },
{ "label": "positive" }
]
}
]
}'

Example response. The answers come back in question order:

{
"instanceId": "b27d4e81-9c0a-4f3b-a6e2-4d1f7c8b3a05",
"answers": [
{ "type": "predicate", "name": "recommends_film", "probability": 0.62 },
{ "type": "choice", "name": "strongest_aspect", "choice": "visuals", "probabilities": [ … ], "confidence": 0.71 },
{ "type": "score", "name": "sentiment", "score": 1.1, "probabilities": [ … ], "confidence": 0.82 }
],
"usage": { … },
"cost": { … }
}

Image: ask about an image​

Images go in a user message as an input_image part, and need a model that accepts images, such as GPT-6 Luna Decisions. This example base64-encodes a local logo.png and passes the body through a heredoc, so the shell can insert the image data:

cURL
IMAGE_BASE64=$(base64 < logo.png | tr -d '\n')

curl -X POST "https://api.serenitystar.ai/api/v2/decisions" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <your-api-key>" \
--data-binary @- <<EOF
{
"vendor": "OpenAI",
"modelCode": "gpt-6-luna",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "An image uploaded to the brand assets library." },
{ "type": "input_image", "imageUrl": "data:image/png;base64,${IMAGE_BASE64}", "detail": "low" }
]
}
],
"questions": [
{
"type": "predicate",
"name": "contains_logo",
"instructions": "Does the image contain a company logo?"
},
{
"type": "choice",
"name": "logo_type",
"instructions": "What kind of logo is it?",
"choices": [
{ "value": "wordmark", "description": "Only the company name, as text." },
{ "value": "symbol", "description": "Only an icon, without the name." },
{ "value": "combination", "description": "An icon next to the company name." }
]
}
]
}
EOF

Example response:

{
"instanceId": "e4a1c9d7-0f2b-4b8e-93c6-5a7d1e2f8b64",
"answers": [
{ "type": "predicate", "name": "contains_logo", "probability": 0.94 },
{ "type": "choice", "name": "logo_type", "choice": "symbol", "probabilities": [ … ], "confidence": 0.99 }
],
"usage": { … },
"cost": { … }
}

The same sample in the playground:

Execution result for the Image sample: the image contains a logo with 94% probability, and the logo type is symbol with 99% confidence

Agent evaluation: check an agent's conversation against a policy​

Send the agent's conversation, including its tool calls and their outputs, and ask whether it behaved correctly. The tool calls are only evaluated; nothing is executed. Like the Image example, this needs a model that accepts full conversations, such as GPT-6 Luna Decisions.

This body contains apostrophes, so it is passed through a quoted heredoc (<<'EOF') instead of -d '…':

cURL
curl -X POST "https://api.serenitystar.ai/api/v2/decisions" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <your-api-key>" \
--data-binary @- <<'EOF'
{
"vendor": "OpenAI",
"modelCode": "gpt-6-luna",
"input": [
{ "role": "system", "content": "You are a support agent. Refunds over $100 need a manager's approval." },
{ "role": "user", "content": "My order A-1001 arrived broken, I want a refund." },
{ "type": "function_call", "callId": "call_1", "name": "lookup_order", "arguments": "{\"orderId\":\"A-1001\"}" },
{ "type": "function_call_output", "callId": "call_1", "output": "{\"total\":240,\"status\":\"delivered\"}" },
{ "type": "function_call", "callId": "call_2", "name": "refund_order", "arguments": "{\"orderId\":\"A-1001\",\"amount\":240}" },
{ "type": "function_call_output", "callId": "call_2", "output": "{\"refunded\":true}" },
{
"role": "assistant",
"phase": "final_answer",
"content": [
{ "type": "output_text", "text": "I've refunded the $240 to your card." }
]
}
],
"questions": [
{
"type": "predicate",
"name": "followed_refund_policy",
"instructions": "Did the agent follow the refund policy?"
},
{
"type": "choice",
"name": "resolution",
"instructions": "How did the agent resolve the request?",
"choices": [
{ "value": "refunded" },
{ "value": "escalated", "description": "Handed over to a manager." },
{ "value": "declined" }
]
}
]
}
EOF

Example response. The agent refunded $240 without a manager's approval, so the policy check scores low:

{
"instanceId": "73f0b8a2-d1c4-4e9a-b5f6-2c8e0a4d9b17",
"answers": [
{ "type": "predicate", "name": "followed_refund_policy", "probability": 0.0 },
{ "type": "choice", "name": "resolution", "choice": "refunded", "probabilities": [ … ], "confidence": 1.0 }
],
"usage": { … },
"cost": { … }
}

The same sample in the playground:

Execution result for the Agent evaluation sample: the refund policy check has a 0% probability of being true, and the resolution is refunded with 100% confidence


Errors​

Decisions returns the standard Serenity* Star API errors. See API Errors for every error code, its response body and how to handle it.