Repository navigation
chassis-harness 0.7.0
pip install chassis-harness==0.7.0- Documentation: https://andreolli-davide.github.io/chassis/
- PyPI: https://pypi.org/project/chassis-harness/0.7.0/
Gives invoke, stream, replay, hooks, budgets, and telemetry one coherent
execution contract: a shared run lifecycle with full attribution on both agent
paths, semantically complete replay keys and results, replayed tool calls that
follow the live boundary, settled hook semantics with surfaced failures,
validated budgets and tool contracts, isolated telemetry failures, and truthful
runtime identity. Every change that can break a caller from 0.6 is listed in
migrations.
Fixed
- Agent lookup runs after readiness reconciliation (roadmap R013).
agents.invoke/streamcallensure_ready()before resolving the agent
runtime and logical revision, so an agent installed or replaced after
Harness.start()resolves and runs — its contributions have mounted (and any
runtime they register exists) before lookup. Generation-owned registrations
are still selected only after the generation is acquired. Evaluation targets
resolve logicalAgentSpecnames as well as raw runtime names. - Invoke and stream share one run lifecycle (roadmap R014). Readiness,
generation acquisition, agent resolution, budget scope, hooks, telemetry,
snapshot attribution, and cleanup run identically for both paths: the same
agent.runspan and snapshot digest are emitted, the parent budget stays
active through before/after hooks and any child-agent call they make, and
every streamed event is stamped with the run's logical agent, revision,
generation, run, and thread attribution (AgentEventgainedthread_id)
instead of trusting a custom runtime to attribute its own events. Hook
failures, agent errors, and cancellation behave identically on both paths. - Replay keys and results are semantically complete (roadmap R015). Model
boundary keys now include normalized stop sequences and every invocation
option — temperature, tools, structured output/response format, provider
options — so requests differing by one semantic option can never collide;
a value that cannot be canonicalized deterministically (arbitrary objects,
non-finite floats) raisesReplayMismatchinstead of being silently omitted.
Recorded results preservellm_outputand per-generation metadata.
ReplaySessiongained cursor-awarehas_remaining()/peek()(and replay
consumption is per key, so out-of-order consumption across keys never skips a
record); replayed tool calls use the cursor-aware check and fall back live
once their records are exhausted. - Migration note: model recordings made with earlier versions omit options
and result metadata from their keys — re-record them for exact matching.
Code that relied onhas()implying an unconsumed record should use
has_remaining(). - Replayed tool calls follow the live boundary (roadmap R016). A replayed
call runs the identical boundary sequence — before hook, authorization,
approval, budget, and thetool.executespan (now taggedreplayed) — fires
the after hook for a successful recorded result, and follows the live failure
shape (error hook, no after hook) for a recorded failure. Replay reuses only
the recorded semantic result (content/artifact/errorstay historical);
duration_seconds,tool_call_id,generation_id, and the new
ToolExecutionResult.run_idare stamped with the current run's attribution,
and replaying in a different generation works cleanly. - Migration note:
ToolExecutionResultgainedrun_id(round-tripped
through replay payloads). Code that assumed replayed results carried the
recording's generation/call ids or its recorded duration should read the
current attribution instead — only the semantic result is historical. - Hook semantics settled and failures surfaced (roadmap R017).
TRANSFORM
now replaces the payload exactly as documented — keys the returned mapping
does not carry are removed — and chained transforms each replace the payload
for the remaining handlers. Hook payloads are deep-frozen (nested mutation
raisesTypeErrorat every depth).RECORDhandler failures on the tool and
agent data-plane are surfaced as structuredhook.failuretelemetry events
(event, handler description, error type — never error text) without failing
the operation; control-plane failures continue to aggregate into the
transition's report. - Migration note: a
TRANSFORMhandler that relied on patch semantics (a
partial mapping merged over the old payload) must now return the complete
replacement payload — omitted keys are removed. Handlers that mutate nested
payload containers must copy them first. - Budgets and tool contracts validate at construction (roadmap R018).
BudgetLimitsrejects negative and non-finite values and requires integers
for count dimensions; consumption amounts are validated the same way at every
charge — fractions on count dimensions raise instead of being truncated
silently (zero remains a valid boundary).ToolPolicynormalizes its
sequences to tuples, deep-freezes metadata, and requires a positive finite
timeout_secondswhen present. An obviously synchronousainvoke
implementation is rejected at registration, and the executor verifies
awaitability at the boundary with a typedToolExecutionError. Wall-clock
enforcement is documented as cooperative — a hard deadline needs a cancellable
boundary of your own. - Migration note: code that passed fractional/negative/non-finite budget
amounts or limits, or a non-positiveToolPolicy.timeout_seconds, now raises
ConfigurationError; tools with a synchronousainvokemust become
async def. - Telemetry failures are isolated and adapter wiring unified (roadmap R019).
The newSafeTelemetrywrapper contains any backend failure at span enter,
update, error, exit, and event time — observability can never break runtime
correctness or suppress another backend — with failures kept visible through
afailurescounter and thechassis.telemetrylogger.TeeTelemetryruns
every backend through it and exposes afailurestotal; the harness wires one
SafeTelemetry(RedactingTelemetry(...))chain around every configured
backend. Registered runtimes that exposebind_harness_services(such as
LangGraphAgent) adopt the harness telemetry and redaction at registration
unless they were constructed with an explicit override. - Runtime snapshots and graph cache validation corrected (roadmap R020).
RuntimeSnapshot.agent_runtimenow reports the identity of the selected
AgentRuntime(runtime_kindwhen the runtime declares one, else its class
name) — custom runtimes are never labelledlanggraph, and snapshots built
without a runtime reportunknown.composition_metadataresolves the same
identity for evaluation experiments.GraphCachevalidatesmax_entries
(non-negative integer;0explicitly disables caching) and documents that
topology or captured static inputs invisible to the cache key require an
AgentDefinition.versionchange, with a guide warning preferring
harness-bound runtime tools over captured static implementations. - Migration note: code that asserted
snapshot.agent_runtime == "langgraph"
for custom runtimes must read the runtime's own identity; snapshots without an
agent run now reportunknowninstead oflanggraph.