Skip to content

v0.9.4

Choose a tag to compare

@vamsiramakrishnan vamsiramakrishnan released this 28 Feb 17:49
· 328 commits to master since this release

What's New in v0.9.4

Uniform Declarative Schema System

  • DeclarativeMetaclass — shared metaclass for all schema types with Annotated type hint introspection
  • 6 schema types: StateSchema, ToolSchema, CallbackSchema, PredicateSchema, PromptSchema, MiddlewareSchema
  • 5 annotation types: Reads, Writes, Param, Confirms, Timeout
  • PredicateSchema is callable — works directly with Route.when() and S.guard()
  • Contract checker Pass 13 validates schema reads_keys against upstream availability
  • Contract checker Pass 14 validates scoped middleware schemas at target agent position

Middleware v2: Mechanism-Level Redesign

  • TraceContext — per-invocation state bag flowing through all middleware hooks
  • Per-agent scopingagents class attribute with string, tuple, regex, or callable matching
  • Topology hookson_loop_iteration, on_fanout_start/complete, on_route_selected, on_fallback_attempt, on_timeout
  • Controllable dispatchDispatchDirective(cancel=True) to skip dispatch tasks
  • Error boundary — middleware exceptions caught, logged, and reported via on_middleware_error
  • Stream lifecycleon_stream_start, on_stream_end, on_backpressure
  • Built-in middlewareTopologyLogMiddleware, LatencyMiddleware, CostTracker

M Module — Fluent Middleware Composition

  • M class — consistent with P, C, S composition surfaces
  • | operatorM.retry(3) | M.log() | M.topology_log()
  • M.scope() — restrict middleware to specific agents
  • M.when() — conditional middleware with string shortcuts, callables, or PredicateSchema
  • Single-hook shortcutsM.before_agent(), M.on_loop(), M.on_route(), etc.

MiddlewareSchema — Typed State Declarations for Middleware

  • MiddlewareSchema class with Reads/Writes annotations
  • schema class attribute on middleware (parallel to agents)
  • Deferred evaluation in _ConditionalMiddleware — guarded async wrappers instead of early None
  • M.when(PredicateSchema) — state-aware conditional middleware

Dispatch/Join/Stream Primitives

  • dispatch() and join() extracted as standalone primitive builders
  • StreamRunner for callback-driven execution with configurable concurrency
  • Source and Inbox for stream input management
  • Execution mode tracking via get_execution_mode()

P Namespace — Composable Prompt System

  • P.system(), P.template(), P.conditional() — frozen, composable prompt transforms
  • .when() conditionality unified across P, C, S modules

Engineering

  • Composable S transformsS.rename(), S.pick(), S.merge(), S.compute(), S.guard()
  • Copy-on-write frozen builders — thread-safe builder reuse
  • Rich .explain() output with data flow visualization
  • 85 commits since v0.9.3, 2062 tests passing