Skip to content

chassis-harness 0.7.0

Choose a tag to compare

@andreolli-davide andreolli-davide released this 22 Sep 09:54
· 61 commits to main since this release
pip install 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/stream call ensure_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 logical AgentSpec names 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.run span 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 (AgentEvent gained thread_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) raises ReplayMismatch instead of being silently omitted.
    Recorded results preserve llm_output and per-generation metadata.
    ReplaySession gained cursor-aware has_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 on has() 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 the tool.execute span (now tagged replayed) — 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/error stay historical);
    duration_seconds, tool_call_id, generation_id, and the new
    ToolExecutionResult.run_id are stamped with the current run's attribution,
    and replaying in a different generation works cleanly.
  • Migration note: ToolExecutionResult gained run_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
    raises TypeError at every depth). RECORD handler failures on the tool and
    agent data-plane are surfaced as structured hook.failure telemetry 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 TRANSFORM handler 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).
    BudgetLimits rejects 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). ToolPolicy normalizes its
    sequences to tuples, deep-freezes metadata, and requires a positive finite
    timeout_seconds when present. An obviously synchronous ainvoke
    implementation is rejected at registration, and the executor verifies
    awaitability at the boundary with a typed ToolExecutionError. 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-positive ToolPolicy.timeout_seconds, now raises
    ConfigurationError; tools with a synchronous ainvoke must become
    async def.
  • Telemetry failures are isolated and adapter wiring unified (roadmap R019).
    The new SafeTelemetry wrapper 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
    a failures counter and the chassis.telemetry logger. TeeTelemetry runs
    every backend through it and exposes a failures total; the harness wires one
    SafeTelemetry(RedactingTelemetry(...)) chain around every configured
    backend. Registered runtimes that expose bind_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_runtime now reports the identity of the selected
    AgentRuntime (runtime_kind when the runtime declares one, else its class
    name) — custom runtimes are never labelled langgraph, and snapshots built
    without a runtime report unknown. composition_metadata resolves the same
    identity for evaluation experiments. GraphCache validates max_entries
    (non-negative integer; 0 explicitly disables caching) and documents that
    topology or captured static inputs invisible to the cache key require an
    AgentDefinition.version change, 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 report unknown instead of langgraph.