#[non_exhaustive]pub enum Effect {
Llm(LlmRequest),
Tool {
name: String,
args: Value,
},
Graph {
graph: Box<Graph>,
input: Value,
mode: GraphEffectMode,
},
Sleep(Duration),
Custom {
kind: String,
payload: Value,
},
}Expand description
Something the runtime does on a step’s behalf.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Llm(LlmRequest)
Call a language model.
Tool
Invoke a registered tool.
Fields
name: StringThe name the tool was registered under — a ToolSpec::name.
args: ValueArguments, as JSON shaped by the tool’s ToolSpec::input_schema.
Graph
Run a Soma graph and hand back its output.
This is the bridge that makes a computational pipeline a first-class tool for an agent: it runs through the ordinary compiler and executor, with the ordinary cache, and the agent just sees a result.
Fields
graph: Box<Graph>The graph to run. Structure travels in the effect itself, so the handler needs no registry lookup to know what it is performing — only the node implementations are resolved on the other side.
mode: GraphEffectModeForward with the states already fitted, or fit first.
Sleep(Duration)
Wait. Journaled like anything else, so a replay does not sleep again.
Custom
An effect this runtime doesn’t know about, for host-supplied handlers.
Fields
kind: StringWhich handler this is meant for — the string
EffectHandler::handles implementations match on.
Implementations§
Source§impl Effect
impl Effect
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
A short label for events and logs. Never includes the payload — a prompt is not something to leak into a log line.
Sourcepub fn is_pure(&self) -> bool
pub fn is_pure(&self) -> bool
Is this effect safe to memoize by content?
Pure effects are cached like any filter output: same input, same
result, reused forever. Impure ones are still journaled — recorded
once per (node, turn) so a replay is faithful — but never reused
across runs, because “the same question asked twice” is genuinely a
different event for a model call or a clock read.
Sourcepub fn cache_key(&self) -> Result<CacheKey>
pub fn cache_key(&self) -> Result<CacheKey>
Content hash, used as the journal key for this effect.
Canonical CBOR, not raw serializer output: an effect carries
user-supplied JSON (Tool { args }, Custom { payload }), and two
encodings of the same object must not produce two journal keys.
Fallible on purpose. The previous encoding fell back to empty bytes, which gave every unserializable effect the same key — a replay would then serve one effect’s recorded result to another. A key that cannot be computed has to mean “not journalable”, never a guess.