Skip to main content

RunConfig

Struct RunConfig 

Source
pub struct RunConfig {
Show 17 fields pub workspace: PathBuf, pub prompt: String, pub provider: Option<BuiltinProvider>, pub base_url: Option<String>, pub model: ModelSelector, pub context: ContextConfig, pub skills: SkillsConfig, pub mcp: McpConfig, pub templates: TemplatesConfig, pub hooks: HooksConfig, pub tools: ToolsConfig, pub shell: ShellAccess, pub effort: Option<Effort>, pub deadline: Option<Duration>, pub tool_budget: Option<usize>, pub token_budget: Option<u64>, pub session_name: String,
}
Expand description

Everything a run needs. Task-specific behavior lives in prompt and in the workspace, never in this struct.

This conflates lifetimes, and split is where the seam is: most of it describes a workspace — where to discover context, which MCP servers to connect — a couple of fields describe the process (provider, base_url, seeded into the private runtime’s recipe per ADR-0018), and only a handful describe one run. A caller sending many prompts at one repository wants Workspace and a RunSpec each; a caller sending one wants this, and pays for the discovery once either way.

Fields§

§workspace: PathBuf§prompt: String§provider: Option<BuiltinProvider>

None auto-detects from the environment.

§base_url: Option<String>

An OpenAI-compatible endpoint to use instead of the provider’s own service. These endpoints use complete local replay instead of automatic previous_response_id chaining. None falls back to BASIS_BASE_URL / OPENAI_BASE_URL.

§model: ModelSelector§context: ContextConfig§skills: SkillsConfig§mcp: McpConfig

Which MCP servers this run connects, and where to look for more.

§templates: TemplatesConfig

Where to look for prompt templates. Discovered, never executed here — a template becomes a prompt only when something renders it.

§hooks: HooksConfig

Where to look for subprocess hooks — external commands with a say over each tool call.

§tools: ToolsConfig

Where to look for declared subprocess tools — programs a workspace’s manifest puts on the model’s roster.

§shell: ShellAccess

Whether the agent may run commands. Granted by default; see ADR-0013.

§effort: Option<Effort>

How hard the model should think. None leaves the provider’s default; unsupported provider/model levels fail instead of being downgraded.

§deadline: Option<Duration>

Gives up on the run after this long.

Unset by default, and unset for an unattended caller too. An attended basis spawn has a person watching, who can tell “thinking hard” from “stuck” in a way no timer can; a caller nobody is watching has to write the bound down in advance, and with no scheduler shipped there is no period for basis to guess one from (ADR-0014).

§tool_budget: Option<usize>

Caps how many tool calls the run may make.

§token_budget: Option<u64>

Caps the tokens the run may report using, input plus output.

Soft by construction: usage is only known once a round has streamed in full, so the round that crosses the line always finishes. This is the bound that maps to money.

§session_name: String

Implementations§

Source§

impl RunConfig

Source

pub fn new(workspace: impl Into<PathBuf>, prompt: impl Into<String>) -> Self

Source

pub fn with_provider(self, provider: BuiltinProvider) -> Self

Source

pub fn with_base_url(self, base_url: impl Into<String>) -> Self

Points the run at an OpenAI-compatible endpoint. A trailing /v1 is stripped during resolution — paste the URL a gateway publishes. Compatible endpoints use complete local replay rather than automatic previous_response_id chaining.

Source

pub fn with_model(self, model: ModelSelector) -> Self

Source

pub fn with_context(self, context: ContextConfig) -> Self

Source

pub fn with_skills(self, skills: SkillsConfig) -> Self

Source

pub fn with_mcp(self, mcp: McpConfig) -> Self

Sets which MCP servers the run connects.

Servers arrive from three places — the caller’s own list, the workspace’s .mcp.json, and the global one — and this is where the first of those goes. See crate::mcp for the precedence.

Source

pub fn with_templates(self, templates: TemplatesConfig) -> Self

Source

pub fn with_hooks(self, hooks: HooksConfig) -> Self

Sets where subprocess hooks are discovered.

A hook is an external command that gets a say over each tool call; see crate::hooks for the wire contract and for what happens when one breaks.

Source

pub fn with_tools(self, tools: ToolsConfig) -> Self

Sets where declared subprocess tools are discovered.

A declared tool is a program a workspace manifest puts on the model’s roster, called with JSON on stdin; see crate::tools::declared for the manifest and what a failing one tells the model.

Source

pub fn with_shell(self, shell: ShellAccess) -> Self

Grants or denies command execution.

Granted by default (ADR-0013). Denying is the read-only posture: it shuts the command tools and nothing else, so it is a narrowing of what this run does, never a claim about what the process could do.

Source

pub fn with_effort(self, effort: Effort) -> Self

Asks the model to think harder, where the provider supports it.

Source

pub fn with_session_name(self, session_name: impl Into<String>) -> Self

Source

pub fn with_deadline(self, deadline: Duration) -> Self

Gives up on the run after deadline.

Every bound here is a graceful end rather than a discarded run: the event stream closes the way it always does, and whatever the model committed before the bound tripped is kept. That is what makes bounding an unattended run safe to do — the alternative, throwing the work away for being one round too long, would make callers reluctant to set one.

Source

pub fn with_tool_budget(self, tool_budget: usize) -> Self

Caps how many tool calls the run may make.

Source

pub fn with_token_budget(self, token_budget: u64) -> Self

Caps the tokens the run may report using, input plus output.

Soft: the round that crosses the line is allowed to finish, because usage is only known once a round has streamed in full. The run ends at that boundary keeping everything it committed, and says so — Bound::TokenBudget on the report, exit 3 from the CLI — whether or not the work it kept amounts to an answer.

Source

pub fn turn_options(&self) -> TurnOptions

The bounds this config puts on every turn the run performs.

Limits only. Cancellation and the graceful stop signal are per-call things a caller holds a token for, not configuration, so they stay at their defaults here and arrive through send_with_options.

Source

pub fn split(&self) -> (WorkspaceBuilder, RunSpec)

The two halves this config conflates: what belongs to the workspace, and what belongs to one run of it.

Every function in this module is config.split() followed by an open().await and a mint, so this is not a second description of the mapping — it is the mapping, and it is public because it is also the migration path. A caller that outgrows one-prompt-per-config keeps the builder, opens it once, and mints a RunSpec per run.

Trait Implementations§

Source§

impl Clone for RunConfig

Source§

fn clone(&self) -> RunConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RunConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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