Expand description
§entelix-runnable
Composition contract for entelix (invariant 7). Defines
Runnable<I, O> and the universal .pipe() connector —
Sequence, Parallel, Router, Lambda, Passthrough, plus the
type-erased AnyRunnable for dynamic dispatch (F12 mitigation).
§Composition surface
Every adapter on RunnableExt returns a concrete Runnable<I, O>
type — chains stay zero-cost in the steady state, with boxing only
at the explicit erase() boundary. The standard adapters:
pipe(next)— sequence two runnableswith_retry(policy)— retry transient errorswith_fallbacks(others)— ordered fallbacks on transient errorsmap(fn)— pure synchronous output transformwith_config(fn)— branch-localExecutionContextmutationwith_timeout(duration)— wall-clock deadline overridestream_with(input, mode, ctx)— convenience streaming entry
Re-exports§
pub use stream::BoxStream;pub use stream::DebugEvent;pub use stream::RunnableEvent;pub use stream::StreamChunk;pub use stream::StreamMode;
Modules§
- stream
- Streaming surface for
Runnable.
Structs§
- Configured
Runnable<I, O>adapter that runsconfigureron a clonedExecutionContextbefore forwarding to the inner. The originalctxthe parent passed in is left untouched.- Fallback
Runnable<I, O>adapter that falls back through a list of alternatives when the primary returns a classifier-approved transient error.- Json
Output Parser - Parses an assistant
Messageas JSON intoT. - Mapping
Runnable<I, P>adapter applying a pure synchronous function to the inner’s output.- Retrying
Runnable<I, O>adapter applying aRetryPolicyto the inner runnable on every invocation.- Runnable
Lambda Runnable<I, O>backed by a user-supplied async closure.- Runnable
Parallel Runnable<I, HashMap<String, O>>that runs every registered branch in parallel against the same input.- Runnable
Passthrough Runnable<T, T>that returns its input unchanged.- Runnable
Router Runnable<I, O>that picks one of several runnables based on a predicate over the input.- Runnable
Sequence - Two
Runnables composed end-to-end.RunnableSequence<I, M, O>reads “input I → middle M → output O”. Created with.pipe(). - Structured
Output Adapter - Adapts a
ChatModel<C, T>toRunnable<Vec<Message>, O>by routing everyinvokethroughChatModel::complete_typed::<O>. - Timed
Runnable<I, O>adapter that aborts the inner withError::DeadlineExceededif it does not complete withintimeout.- Tool
ToRunnable Adapter - Wraps any
ToolasRunnable<serde_json::Value, serde_json::Value>.
Traits§
- AnyRunnable
- Object-safe variant of
Runnablethat operates onserde_json::Valueat the public interface. Useful for tool registries, dispatch tables, and dynamic plug-in points. - Chat
Model Ext - Extension methods on
ChatModelthat produce typedRunnableadapters. - Runnable
- One end of a composable computation.
- Runnable
Ext - Ergonomic composition surface, blanket-implemented for every
Runnable<I, O>.
Functions§
- erase
- Wrap a typed
Runnable<I, O>as anAnyRunnableby transcoding I/O throughserde_json::Value. ReturnsArc<dyn AnyRunnable>so the result drops directly into a registry.
Type Aliases§
- AnyRunnable
Handle - Convenience
Arc<dyn AnyRunnable>alias for registries / dispatch tables.