v0.1.5 — TRACE 0.5.x runtime alignment
Highlights
This release brings the SDK into full alignment with the TRACE 0.5.x runtime + RunPod handler. Every wire shape that production callers consume (groundedness scoring, redaction, compression, memory, rollup) now has a typed Pydantic model that mirrors the server schema field-for-field.
Behavior fixes (callers see immediately)
- RunPod error envelope decoded.
_envelope_from_bodynow acceptserror_code/error(the keys the RunPod handler emits via_service_error_payload) in addition to the RESTcode/messageshape. Pre-0.1.5 SDKs silently degraded RunPod failures toHTTP {status}. languageis the canonical request field.GroundednessRequest.languagenow drives the per-class calibration bundle.localebecomes a deprecated alias kept for back-compat — pre-0.1.5 callers usinglocalehad their language hint silently dropped server-side.- RunPod default
response_format=canonical. The typedGroundednessResponsenow populates nestedscores/runtime_decision/corpus_routeblocks instead of receiving the flat compact dict (which left most typed fields atNone). Override by passingresponse_format="compact"explicitly. - First-class scoring kwargs.
score_groundednessexposesprofile,response_format,include_triangular_diagnostics,evidence_limit,heatmap_format,auto_decidedirectly (still allowsextra=for forward-compat). rollup()shape is consistent. REST and RunPod transports now return the same metrics dict — the RunPod{success, action, rollup: {...}, version}envelope is unwrapped into the canonical metrics shape. Passas_model=Trueto receive the new typedRollupResponse.- 422
detaillists (FastAPI validator errors) now surface a useful message (validation error at body.response_text: Field required) instead ofHTTP 422.
Typed model parity bumps
RuntimeDecisionaddsband,policy_version,policy_sha256,head_registry_sha256,head_version,reason_codes,evidence(typedRuntimeEvidenceUnit),unsupported_spans(typedRuntimeUnsupportedSpan),allow_disabled,block_disabled,allow_threshold,block_threshold,rollback_safe— fullRuntimeDecisionRecordparity, including the newcalibration_band_coercion:redreason code.GroundednessScoresaddsnli_aggregate,primary_score/primary_name,reverse_context*,semantic_entropy_*,literal_*,structured_*,context_*_ratio,support_units_usage_*, AST/phantom code-lane channels.GroundednessResponseadds top-levelband/score/groundedness_v2,corpus_route(typed),heatmap,warnings,scoring_mode,profile,effective_profile,session_id,*_diagnostics,next_session_state/next_memory_state.MemoryUpdateResponse.hot_contextis now required (server contract guarantees it);CompressionResponse.providerstaysOptional[str].- New
RollupResponse,RollupTopDeadFile,RollupDriftTrend,CorpusRoute,RuntimeEvidenceUnit,RuntimeUnsupportedSpanexported at the package root.
Helper updates
GroundednessResponse.fill_native_risk_bandpromotesrisk_bandfromscores.risk_band → top-level band → runtime_decision.band(priority order matches the new backend coercion).integrations._band_utils.resolve_band/resolve_scoreprefer the calibrationrisk_band/trace_scoreover the head-drivenruntime_decision.band/decision.score, so adapter consumers render the same band the event log shows.
Deferred to a future release
- Typed RunPod action mappings for the nine
/v1/trace/sessions*paths (session.create/get/event/score/context/source/repair/rollup/close). Those need typed session models and live outside the groundedness/rollup hot path — best done as a focused 0.2.0 surface bump.
Tests
41 unit tests passing (27 existing + 14 new alignment regressions covering: error envelope decoding, 422 detail-list parsing, language alias + conflict guard, first-class kwargs, RunPod canonical default, REST no-default, RunPod rollup normalization, REST rollup typed model, full runtime_decision typing with calibration_band_coercion, expanded GroundednessScores, compact band/score promotion, and _band_utils priority).
Install
pip install -U latence==0.1.5