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
| Field | Type | Description |
|---|---|---|
model | string | Optional. hartley-1 (default) or hartley-1-flash. See Models and pricing. |
state | any JSON or string | What the questions are about. Required. |
questions | object | Name → question. One or more; names are 1–128 characters and come back as the keys of answers. See Question types. |
options.abstain | boolean | Default true: every question can answer "can't tell" when the state lacks the evidence. |
options.calibration | global | none | Default global: calibrated probabilities. none returns the model's raw probabilities. |
A question
| Field | Type | Description |
|---|---|---|
type | noul | choice | score | extract | What kind of answer you want. |
instructions | string, object or array | The question itself, in words. |
criteria | list or object | The options: names, or {name: description}. Required for choice and score; optional for noul; not used by extract. |
extract | object | For 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.