pub struct WorkflowCtx { /* private fields */ }Expand description
Shared, cheaply-cloneable workflow run context.
Implementations§
Source§impl WorkflowCtx
impl WorkflowCtx
Sourcepub fn builder(provider: Arc<BoxedProvider>) -> WorkflowCtxBuilder
pub fn builder(provider: Arc<BoxedProvider>) -> WorkflowCtxBuilder
Start building a context from a type-erased provider.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the run has been cancelled.
Sourcepub fn stop(&self)
pub fn stop(&self)
Stop the run: fires the shared cancellation token so in-flight agents
wind down at their next leaf cancel-check (and combinator tasks abort).
Idempotent. Restarting a stopped run is done by re-running with a resume
journal: completed agents replay, the
stopped ones run live.
Sourcepub fn cancellation_token(&self) -> CancellationToken
pub fn cancellation_token(&self) -> CancellationToken
A clone of the run’s cancellation token (for external pause/stop wiring).
Sourcepub fn spawned(&self) -> u64
pub fn spawned(&self) -> u64
Total agents issued so far (monotonic; includes rejected admissions).
Sourcepub fn max_agents(&self) -> u64
pub fn max_agents(&self) -> u64
The configured runaway agent backstop.
Sourcepub fn remaining(&self) -> u64
pub fn remaining(&self) -> u64
Remaining budget headroom, or u64::MAX if unbounded. Drives
loop-until-budget: while ctx.remaining() > threshold { … }.
Sourcepub fn control_breach(&self) -> Option<ControlBreach>
pub fn control_breach(&self) -> Option<ControlBreach>
The first run-level limit breach, if one has occurred.
Trait Implementations§
Source§impl Clone for WorkflowCtx
impl Clone for WorkflowCtx
Source§fn clone(&self) -> WorkflowCtx
fn clone(&self) -> WorkflowCtx
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more