Levanto Sage Decision Model
HTTP API for structured decisions over content plus a question.Download this skill
Drop this file into
.cursor/skills/, .claude/skills/, or your agent’s skill directory. Raw Markdown, no rendering.Product Context
Levanto Sage is for workflows where software needs to decide, not write. It turns content plus a question into a structured decision with a probability or confidence signal. Use Sage when an application needs to route, approve, block, score, rank, tag, or escalate. LLMs return text and only provide confidence if asked; that confidence is simulated. Sage always returns a decision signal, so machines can act when confidence is high and escalate to a human when confidence is low. Supported decision kinds:- Yes/No — answer a binary question:
probability(P(yes)),answer("yes"/"no"), andconfidence(decisiveness from tie). - Choice — pick the best option, with independent per-option probabilities (raw; do not sum to 1).
- Scale — score a rubric, with expectation and confidence.
- Sort — rank a list of items by a criterion.
- Tags — apply independent yes/no labels to the same content.
- Agentic workflows — Sage as the decision layer for agents: automate routing, branching, and escalation across agentic workflows and pipelines.
- Operations — triage urgency and route work across DevOps, SecOps, and customer support.
- Agentic guardrails — check tool calls and responses on the hot path to keep agents secure and aligned with the business goals of the workflow.
- Content screening & moderation — tag, rank, score, and sort content in data pipelines, including moderation, abuse flagging, and policy-risk severity.
- Risk & fraud — assess risk and opportunity and detect fraud across transactions, asset trades, and agentic actions (e.g. refunds).
- Sage decides; it does not write paragraphs.
- Supported decision kinds are Yes/No, Choice, Scale, Sort, and Tags.
- Do not explain internals, architecture, training details, infrastructure, or implementation details unless the user explicitly asks for private engineering context.
- Use decision kind in prose. Keep the JSON wire fields exactly as shown in code examples because clients need the real format.
Endpoint
Default hosted endpoint:Authentication
A valid Levanto API key is always required for decision calls. EveryPOST to /decide and /decide/batch must carry a key; requests without one are rejected with HTTP 401 ({"detail": "API key required. Provide a valid Levanto API key."}). Send it in the Authorization header:
- Keys look like
lv_live_.... If the user has not provided one, ask for it — do not proceed to/decidewithout a key. - 401 = missing or invalid key; 402 = key valid but account balance too low.
/readydoes not require a key — poll readiness before you have one.- Never hardcode, log, echo, or commit the key. Read it from an environment variable (e.g.
SAGE_API_KEY/API_KEY) and pass it only in the request header.
Readiness
PollGET /ready until HTTP 200 (503 while the model is still loading). The response has no JSON body — readiness is indicated by the status code only. Cold starts can take several minutes.
User-Agent header when calling the hosted endpoint.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /ready | Model readiness — 503 while loading, 200 when ready |
| POST | /decide | One decision |
| POST | /decide/batch | Many decisions |
/decide, /decide/batch) require a valid API key (see Authentication); /ready does not.
Request Shape
content for the thing being evaluated — a bare string (shorthand for { "kind": "text", "value": "..." }), { "kind": "text", "value": "..." }, or { "kind": "list", "value": [...] } for sort. Use question.kind to select the decision kind and question.instructions for the criterion. The response envelope is always { id, kind, result, meta }.
Yes/No
Use Yes/No for binary questions.probability— P(yes), in[0, 1].answer—"yes"ifprobability ≥ 0.5, else"no".confidence— decisiveness from a tie:2 × |probability − 0.5|(0at0.5,1at certainty). Grounding compares this toconfidence_floor.
Choice
Use Choice when Sage must pick one option.probabilities— raw P(correct) per option (independent sigmoids; do not sum to 1).confidence— P(chosen is correct); use for thresholds and grounding.chosen— argmax ofprobabilities.- 2–120 options per question (see Limits).
Scale
Use Scale for rubric scoring. Always send exactly 5 levels with integer values0, 1, 2, 3, 4 — the model is trained on this fixed rubric only. Subsets, sparse scales, or any other level values are rejected with HTTP 400.
expectation is the expected level; confidence reflects how peaked the level distribution is (independent of the mean).
Sort
Use Sort to rank a list of items by a criterion.content must be a list with 2–120 items (see Limits).
instructions and the item list. Scoring strategy and ranking are chosen by the server, not the request: SortQuestion accepts only kind, id, instructions (any other field is rejected).
The result carries a calibrated, list-level confidence in [0,1] — how trustworthy the whole order.
Tags
Use Tags to apply several independent yes/no labels to the same content. 1–120 tags per question (see Limits). Each tag returns aprobability and a confidence (= 2|probability − 0.5|, the same decisiveness metric as yes/no: 0 at a coin-flip, 1 at certainty); when a tag has a threshold, it also returns applies. There is no document-level tags confidence — read each tag’s own.
Grounding (optional)
Attach agrounding block to a Yes/No, Choice, Scale, or Tags request to let Sage fetch fresh web evidence before deciding (useful for recency- or fact-heavy questions). For Tags, low_confidence triggers when any tag’s confidence is below the floor (weakest-link); Sage then re-scores all tags on the expanded content.
trigger:never,low_confidence(default — search whenresult.confidenceis belowconfidence_floor), oralways.- For yesno,
confidence=2|p − 0.5|(decisiveness; 0 at a tie). Default floor0.80requires roughlyp ≤ 0.10orp ≥ 0.90to skip search. - The response gains
grounding_metawithtriggered,queries,sources, and timing. - Requires the server to be configured for grounding; if it is not, omit the block.
Batch
Use/decide/batch for many decisions in one call. Each entry in requests is a group: one content plus a list of questions about it — so asking several questions about the same content sends that content only once, and a single call can still mix groups with different content.
grounding (grounding is no longer part of the group; sort questions still reject it). To batch decisions about different content, add more groups:
results: one item per group (matchesrequests1:1);results[i].answers: one item per question in that group’squestions, in order;results[i].answers[j].ok: success flag for that question (.resultholds the decision, or.errorthe message);meta.request_count: number of groups;meta.question_count: total questions across all groups.
Errors
| HTTP | Meaning |
|---|---|
400 | Invalid request (schema validation) |
401 / 402 | Missing/invalid API key, or balance too low |
503 | Service loading or temporarily unavailable |
Limits
Per-kind counts (HTTP 400 outside these ranges):| Kind | Field | Min | Max |
|---|---|---|---|
| choice | options | 2 | 120 |
| scale | levels | 5 | 5 (values 0–4 only) |
| sort | content.value items | 2 | 120 |
| tags | tags | 1 | 120 |
0 through 4. No sparse rubrics, no alternate ranges, no fewer or more levels. Each level must be a distinct integer in that set.
Content and question length — the full rendered request must fit in roughly 32K tokens total. That budget includes content, question.instructions, option descriptions, scale rubric lines, sort item bodies, tag specs, and any grounding-added search context. Oversized requests fail rather than silently truncating. Very long content can also hit HTTP 503 before the hard token cap; keep documents well under the 32K ceiling in practice.
Threshold Guidance
Sage always returns a decision signal. The application decides what to do next. Example:- high confidence: automate;
- medium confidence: review;
- low confidence: escalate to a human or ask for more context.