Skip to main content

Module transform

Module transform 

Source
Expand description

The one extension point: rewriting the event stream on its way out.

Event observers, filters and rewriters implement StreamTransformer. Built-in transformers include ToolResultToState and SubagentVisibility.

Transformers run in the order they were added, each seeing what the previous one produced, before the ordering verifier sees anything. That order is what makes FilterToolCalls safe: the verifier never sees the half of a tool call that was dropped.

let chain = TransformerChain::new()
    .with(FilterToolCalls::deny(["internal_debug"]))
    .with(ToolResultToState::snapshot("load_document").replacing());
assert_eq!(chain.len(), 2);

Structs§

FilterToolCalls
Drops whole tool calls by tool name.
SubagentFilter
The transformer behind SubagentVisibility.
ToolResultToState
Promotes a named tool’s result into a state event.
TransformerChain
Transformers applied in sequence.

Enums§

SubagentVisibility
What a consumer sees of an agent’s subagents.

Traits§

StreamTransformer
Rewrites events on their way from an agent to the transport.