pub struct EffectDriver { /* private fields */ }Expand description
Drives steps: performs their effects, journals them, emits their events.
Implementations§
Source§impl EffectDriver
impl EffectDriver
Sourcepub fn new(journal: EffectJournal) -> Self
pub fn new(journal: EffectJournal) -> Self
A driver over journal, with no handlers yet — add them with
Self::with_handler; an effect nobody claims is a clear error.
Sourcepub fn with_catalog(self, catalog: Arc<NodeCatalog>) -> Self
pub fn with_catalog(self, catalog: Arc<NodeCatalog>) -> Self
Provide the step library that dynamic fan-out draws from.
Sourcepub fn with_handler(self, handler: Arc<dyn EffectHandler>) -> Self
pub fn with_handler(self, handler: Arc<dyn EffectHandler>) -> Self
Add a handler. The first whose handles() claims an effect performs it.
Sourcepub fn with_event_bus(self, bus: Arc<EventBus>) -> Self
pub fn with_event_bus(self, bus: Arc<EventBus>) -> Self
Emit the agent events (turns, effects, handoffs) to this bus.
Sourcepub fn run(
&self,
step: &dyn Step,
run_id: &str,
node_id: &str,
input: &Value,
) -> Result<NodeOutcome>
pub fn run( &self, step: &dyn Step, run_id: &str, node_id: &str, input: &Value, ) -> Result<NodeOutcome>
Run a step to completion.
Bounded by somatize_core::step::StepMeta::max_turns: a step that
has not finished by then is looping, and stopping with a clear error
beats burning tokens until something else gives out.
Sourcepub fn resume_with(
&self,
run_id: &str,
node_id: &str,
turn: usize,
reason: &SuspendReason,
answer: Value,
) -> Result<()>
pub fn resume_with( &self, run_id: &str, node_id: &str, turn: usize, reason: &SuspendReason, answer: Value, ) -> Result<()>
Deliver the answer a suspended run was waiting for.
Recorded at the exact site the step suspended, so the next run under the same id replays to that point and finds it. There is no separate checkpoint file: the journal is the checkpoint.
node_id, turn and reason come from the
NodeOutcome::Paused that stopped the run.
Trait Implementations§
Source§impl Clone for EffectDriver
impl Clone for EffectDriver
Source§fn clone(&self) -> EffectDriver
fn clone(&self) -> EffectDriver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more