decide.v1

docs/capabilities/decide.v1.md · wiki index

decide.v1

Status: v1. A published shape is frozen by spec.md section 20.1. Capability key: decide Route: POST /decide

Parts in

One row for each part kind that this capability accepts. A kind that is not in this table is invalid_part.

kindrolerequiredmeaning
textquestionyes, exactly onethe question that the model must answer.
jsonoptionsyes, exactly one{"options": [{"id": "...", "label": "...", "description": "..."}]}.
imageanynooptional visual context for the question.

Parameters

This capability has no parameters. A value in params is ignored (R26). The options part carries the whole choice set.

Channels out

One row for each channel that this capability can emit.

channelmimepayload
decisionapplication/json{"chosen": "<id>", "options": [{"id": "...", "probability": 0.0}]}

Terminal metadata

done.meta is vocabulary-defined. The core stores it and never reads it. done without meta means {}.

keytypemeaning
modelstringthe served name that ran the job

model is present when outcome is completed. It is absent when the outcome is cancelled or expired.

Request

POST /decide
{
  "model": "<served-name>",
  "input": [
    {"kind": "text", "role": "question", "text": "Which queue should this job enter?"},
    {"kind": "json", "role": "options", "json": {"options": [
      {"id": "fast", "label": "Fast lane", "description": "Small jobs with a short deadline."},
      {"id": "bulk", "label": "Bulk lane", "description": "Large jobs with no deadline."}
    ]}}
  ],
  "params": {},
  "stream": false
}

Response, no stream

{"job": "019...", "outcome": "completed",
 "decision": {"mime": "application/json", "inline": {"chosen": "fast", "options": [
   {"id": "fast", "probability": 0.82}, {"id": "bulk", "probability": 0.18}]}},
 "usage": {"tokens_in": 24, "tokens_out": 3},
 "meta": {"model": "<served-name>"}}

Stream

decide emits one decision event, then the done frame. No other event appears.

event  ch=decision application/json {"chosen":"fast","options":[{"id":"fast","probability":0.82},{"id":"bulk","probability":0.18}]}
done   outcome=completed meta={"model": "<served-name>"}

Rules

  1. Exactly one text part with role question is required. A request without it is invalid_part.
  2. Exactly one json part with role options is required. A request without it is invalid_part.
  3. An audio, video, or tokens part is invalid_part. An image is optional visual context; a model that does not declare image support refuses it.
  4. Every entry of the options array names id, label, and description. A missing key gives a refusal that names options.
  5. The options array holds at least two entries. Fewer than two gives a refusal that names options.
  6. Every id in the options array is unique. A repeated id gives a refusal that names options.
  7. chosen is one id from the request. A value outside that set is a protocol error.
  8. The payload options array lists every requested id, once each. Its length equals the length of the request array.
  9. Each probability is a float. It is never negative and never above one.
  10. The payload probabilities add to one for one job.
  11. chosen names the entry with the highest probability. A tie keeps the request order.
  12. The payload carries no label and no description. Those strings never appear in the output.
  13. The plugin emits one decision event and nothing else for this job. A second decision event is a protocol error.
  14. A value in params does not change the emitted decision.
  15. usage.tokens_in counts the question and the options. usage.tokens_out counts the emitted answer tokens. Both are present when outcome is completed.
  16. No event follows a cancel. The terminal frame is done with outcome = cancelled, and it carries no metadata keys.