POST /v1/decide

Ask typed questions about a state.

The one endpoint. Send a state and named questions; get a calibrated answer for each, from one read of the state. New to the ideas? Start with How Hartley works.

curl https://models.trodo.ai/v1/decide \
  -H "Authorization: Bearer $TRODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "hartley-1",
  "state": {
    "system_prompt": "Never promise refunds over $100 without a manager.",
    "messages": [
      {"role": "user", "content": "I want my $250 back."},
      {"role": "assistant", "content": "Done, I have refunded the full $250."}
    ]
  },
  "questions": {
    "followed_policy": {"type": "noul", "instructions": "Did the agent follow its system prompt?"},
    "next_step": {
      "type": "choice",
      "instructions": "What should happen next?",
      "criteria": {"escalate": "Hand to a manager", "close": "Close the ticket", "ask_user": "Ask the user for more detail"}
    }
  }
}'

Request body

FieldTypeDescription
modelstringOptional. hartley-1 (default) or hartley-1-flash. See Models and pricing.
stateany JSON or stringWhat the questions are about. Required.
questionsobjectName → question. One or more; names are 1–128 characters and come back as the keys of answers. See Question types.
options.abstainbooleanDefault true: every question can answer "can't tell" when the state lacks the evidence.
options.calibrationglobal | noneDefault global: calibrated probabilities. none returns the model's raw probabilities.

A question

FieldTypeDescription
typenoul | choice | score | extractWhat kind of answer you want.
instructionsstring, object or arrayThe question itself, in words.
criterialist or objectThe options: names, or {name: description}. Required for choice and score; optional for noul; not used by extract.
extractobjectFor extract only, optional: kind (any, number, amount, date, phone, email, name, text) and max_candidates (1–128, default 48).

A call on a few thousand tokens usually comes back in about a second; longer states take longer. After a quiet spell the first call can take up to a minute while the model starts, so give your HTTP client a timeout of at least 120 seconds.

The response is described in Reading the response; errors in Errors. Coming from TypeSafe? POST /v1/systemone takes their request shape: see Coming from TypeSafe.

On this page