Pre-release Harn is pre-1.0 — the language, standard library, and CLI may change between releases. See the release notes

Decision evaluation contract

harness.llm.evaluate(id, state, questions, policy) evaluates a set of questions over one shared state and returns a closed EvaluationOutcome union. harness.llm.evaluate_predicate(id, question, input, policy) is the single-boolean projection with a PredicateOutcome union. The authoritative type declarations and builders are in std/predicate.

Questions and policy#

The question map is keyed by stable IDs. All questions need nonempty instructions.

BuilderQuestion fieldsAnswer fields
boolean(instructions)kind: "boolean"verdict, yes probability, confidence, evidence
choice(instructions, criteria)kind: "choice"; label-to-description mapselected choice, per-label probabilities, confidence, evidence
score(instructions, levels)kind: "score"; ordered labels, lowest firstselected level, fractional score, per-level probabilities, confidence, evidence

Each answer carries confidence_kind and evidence_kind. The policy declares backend (structured_llm or native_decision), provider, model, and a threshold in [0, 1]. Optional effort, temperature, evaluation_cost_limit, and run_cost_limit travel with the request. Route limits are checked before dispatch; an invalid question returns question_invalid with the offending question ID and reason, with no provider charge.

Outcome arms#

Every arm carries a receipt handle. Match on kind before reading its arm-specific fields.

kindFields beyond receiptMeaning
answeredvalueEvery declared question has an answer at or above the threshold.
low_confidencecandidates, threshold, question_idsAnswers exist, but the named questions fell below the threshold.
refusedreason, diagnosticProvider refusal, invalid response schema, or truncated output.
budget_cutlimit, requested, remainingA request, token, deadline, cost, or parent budget stopped dispatch.
unavailablereasonRoute, authority, spend admission, transport, producer, or cache failure.
replay_mismatchexpected_identity, actual_identity, occurrenceThe request differs from the offline record.
cancelledcontrol_eventA stop or cancellation was accepted.
state_too_largelimit_tokens, estimated_tokensThe supplied state exceeds the route's declared window.
question_invalidquestion, reasonThe question set violates a declared shape or route limit.
rate_limitedoptional retry_after_msThe provider returned a rate limit.
overloadednoneThe provider is overloaded.

The single-boolean projection uses verdict with value, or low_confidence with candidate, instead of the batched answered arm. It shares the remaining refusal and control arms.

Retained receipt accounting#

harness.llm.evaluation_receipt(reference) reads the accounting projection for an occurrence returned by any evaluator method. It makes no provider request. kind: "retained" carries a typed receipt with schema harn.evaluation.accounting.v1: occurrence and route identity, outcome, physical attempts, accounting status, tokens, settled cost, and budget charge. Its optional usage_certainty preserves the usage owner's known cost and unpriced-call coverage when a total bill remains unknown. Its optional native_transport preserves reported downstream attempts and provider, plus the full data-control receipt, including caveats. Missing reports remain nil; a budget charge doesn't establish a settled provider bill.

kind: "unavailable" carries reason: "malformed_reference", "foreign_execution", or "not_retained". Unknown occurrences and journal overflow return not_retained. The execution retains at most 1024 receipts; child VMs share that journal. Lookup doesn't create receipts or recover dropped ones. Full receipts remain in the run record's evidence.evaluation_receipts.

The replay how-to explains exact request binding and the receipt's source and reused_from fields. A receipt proves what route answered and what was charged for this invocation. It does not establish that the answer is correct or that its confidence is calibrated; see the confidence explanation and std/eval/calibration.