Skip to main content

WorkflowCtxBuilder

Struct WorkflowCtxBuilder 

Source
pub struct WorkflowCtxBuilder { /* private fields */ }
Expand description

Builder for WorkflowCtx.

Implementations§

Source§

impl WorkflowCtxBuilder

Source

pub fn base_tools(self, tools: Vec<Arc<dyn Tool>>) -> Self

Set the default tool set wired into every agent leaf that does not supply its own per-call tools (see AgentCall::tools).

Source

pub fn max_concurrency(self, n: usize) -> Self

Override the concurrency cap (must be >= 1).

Source

pub fn max_agents(self, n: u64) -> Self

Override the runaway agent backstop (must be >= 1).

Source

pub fn budget(self, total: u64) -> Self

Set a hard token-equivalent budget ceiling for the run (0 ⇒ unbounded). Default is unbounded.

Source

pub fn budget_pool(self, budget: Budget) -> Self

Share an existing Budget pool (e.g. a parent run’s, for nested workflows). This and budget write the same slot, so whichever is called last wins (last-write-wins, not unconditional precedence).

Source

pub fn journal( self, path: impl AsRef<Path>, mode: ResumeMode, ) -> Result<Self, Error>

Enable deterministic resume by journaling agent outputs to path (a .jsonl file). ResumeMode::Fresh starts a new journal; ResumeMode::Resume replays matching calls from an existing one. Returns an error if the journal file cannot be opened.

See RunJournal for the soundness scope (return values, not side effects; single process; fixed provider).

Source

pub fn journal_handle(self, journal: Arc<RunJournal>) -> Self

Share an existing RunJournal handle (e.g. a parent run’s).

Source

pub fn on_event(self, callback: Arc<OnWorkflowEvent>) -> Self

Install a workflow event sink.

Source

pub fn on_agent_event(self, callback: Arc<OnEvent>) -> Self

Install an AgentEvent sink: every inner AgentRunner built by the agent leaves forwards its full event stream (tool calls, LLM responses, run lifecycle) here. Lets a host (e.g. the TUI trace) observe recipe-internal activity that would otherwise stay invisible behind the tool boundary.

Source

pub fn provider_factory(self, factory: Arc<ProviderFactory>) -> Self

Install the per-call model resolver (see ProviderFactory): lets agent(&ctx, …).model("fast") run a leaf on a different provider.

Source

pub fn workspace(self, root: impl Into<PathBuf>) -> Self

Set the workspace (git repo root) — required for leaves that ask for Isolation::Worktree.

Source

pub fn cancellation_token(self, token: CancellationToken) -> Self

Provide an external cancellation token (defaults to a fresh one).

Source

pub fn build(self) -> Result<WorkflowCtx, Error>

Build the context.

Rejects a zero concurrency cap or zero agent backstop (consistent with the zero-rejection in crate::agent::batch and the workflow agents).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more