Run judgment recipes
Create three question sets, test them against fictional evidence, and bind each published version to a Flow. The examples cover support routing, claim grounding, and editorial scoring. They don’t send messages, issue refunds, or publish content.
Before you begin
Use a Runtype API key with an organization context and the QUESTION_SETS:WRITE, TOOLS:EXECUTE, and FLOWS:WRITE scopes. Install curl, jq, and Bash.
These REST recipes require no feature flag. The Flagship flag enable-decision-models-dashboard controls only the optional Tools > Question sets dashboard, not model discovery, question-set authoring, or execution.
Each test calls a model and can incur usage charges. Each recipe creates a question set and a Flow. A failed later step doesn’t delete resources that an earlier step created. Inspect the printed IDs before retrying.
Set the API key and model for the examples:
Replace YOUR_API_KEY with your Runtype API key. Keep the key out of browser code, source control, and shared logs.
List supported models before changing DECISION_MODEL:
The catalog lists supported routes, limits, and credential requirements. It doesn’t confirm that your organization can run a model. The test call checks credentials and policy.
Define the create, publish, test, and bind commands
Save this function in your Bash session. It accepts a question-set JSON file and an evidence JSON file:
The function creates a draft, publishes it, tests the configured tool, then creates a Flow with a pinned Tool Call step. A refusal or missing answer stops the function before it creates the Flow.
Each saved Flow contains the same fictional evidence used in the test. Replace that fixture with your application evidence before production use. inputMapping doesn’t assemble evidence at runtime.
Route a support request
Save a question set that separates queue selection from a request for a person:
Save a ticket with both a billing request and an explicit human-handoff request:
Create, publish, test, and bind the question set:
Inspect result.route and result.requestsHuman in the printed test response. The intended labels are billing and true. A response might contain the following illustrative answers:
Preserve both answers in the next step. Routing to billing must not discard the human request. A billing label doesn’t authorize repayment.
Before automating routing, label mixed requests, out-of-scope tickets, quoted requests, and account-recovery cases. Measure wrong-queue and missed-handoff rates separately.
Check an answer against its source
Save a question set that distinguishes supported, contradicted, and unaddressed claims:
Save a claim that conflicts with the supplied policy:
Create, publish, test, and bind the question set:
Inspect result.relation. The intended label is contradicted. An illustrative result is:
Route this draft to correction or review. A missing source means not verified, not necessarily false. Check quote membership and source identity in code before the semantic check.
Test false acceptance using unsupported qualifiers, outdated policies, fabricated quotes, and instructions embedded in the source. The TypeSafe citation cookbook separates exact quote matching from contextual support.
Score a draft on separate dimensions
Save a rubric for completeness and clarity:
Save a readable draft that omits the save action:
Create, publish, test, and bind the question set:
Inspect both dimensions. The completeness rubric assigns the omitted action to level 1. Clarity can still be high. An illustrative response is:
Keep incomplete drafts in the editing queue even when clarity is high. A weighted score can order that queue, but must not cancel a required completeness check.
Label the expected level on each dimension with your editors. Evaluate their agreement before fitting a model threshold. Compare the final editorial ordering separately from per-question accuracy.
Evaluate before adding action branches
The examples establish request shapes and intended behavior. Their probabilities are illustrative, not measured results or recommended thresholds.
Save representative cases with a unique ID, state, and expected label for every question. Boolean labels are true or false; Choice labels are strings; Score labels are integer level indices.
A labeled support case has this shape:
Use a separate held-out set to measure each fitted threshold. Record correct and handled counts, unavailable answers, refusals, and calls that fail. Don’t infer reliability from one successful fixture.
Persist the tested question-set version and model identity with your results. Re-evaluate after changing the evidence builder, questions, provider, or action policy. See calibration for the record format and limits.
Next steps
- Designing judgments: improve evidence, answer choices, and rubric levels.
- Using conditional steps: add branches after you validate an action policy.
- Judgments: inspect provider selection, response fields, and error handling.