pub struct WorkflowCtxBuilder { /* private fields */ }Expand description
Builder for WorkflowCtx.
Implementations§
Source§impl WorkflowCtxBuilder
impl WorkflowCtxBuilder
Sourcepub fn base_tools(self, tools: Vec<Arc<dyn Tool>>) -> Self
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).
Sourcepub fn max_concurrency(self, n: usize) -> Self
pub fn max_concurrency(self, n: usize) -> Self
Override the concurrency cap (must be >= 1).
Sourcepub fn max_agents(self, n: u64) -> Self
pub fn max_agents(self, n: u64) -> Self
Override the runaway agent backstop (must be >= 1).
Sourcepub fn budget(self, total: u64) -> Self
pub fn budget(self, total: u64) -> Self
Set a hard token-equivalent budget ceiling for the run (0 ⇒ unbounded).
Default is unbounded.
Sourcepub fn budget_pool(self, budget: Budget) -> Self
pub fn budget_pool(self, budget: Budget) -> Self
Sourcepub fn journal(
self,
path: impl AsRef<Path>,
mode: ResumeMode,
) -> Result<Self, Error>
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).
Sourcepub fn journal_handle(self, journal: Arc<RunJournal>) -> Self
pub fn journal_handle(self, journal: Arc<RunJournal>) -> Self
Share an existing RunJournal handle (e.g. a parent run’s).
Sourcepub fn on_event(self, callback: Arc<OnWorkflowEvent>) -> Self
pub fn on_event(self, callback: Arc<OnWorkflowEvent>) -> Self
Install a workflow event sink.
Sourcepub fn on_agent_event(self, callback: Arc<OnEvent>) -> Self
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.
Sourcepub fn provider_factory(self, factory: Arc<ProviderFactory>) -> Self
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.
Sourcepub fn workspace(self, root: impl Into<PathBuf>) -> Self
pub fn workspace(self, root: impl Into<PathBuf>) -> Self
Set the workspace (git repo root) — required for leaves that ask for
Isolation::Worktree.
Sourcepub fn cancellation_token(self, token: CancellationToken) -> Self
pub fn cancellation_token(self, token: CancellationToken) -> Self
Provide an external cancellation token (defaults to a fresh one).
Sourcepub fn build(self) -> Result<WorkflowCtx, Error>
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).