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: McpConfigWhich MCP servers this run connects, and where to look for more.
templates: TemplatesConfigWhere to look for prompt templates. Discovered, never executed here — a template becomes a prompt only when something renders it.
hooks: HooksConfigWhere to look for subprocess hooks — external commands with a say over each tool call.
tools: ToolsConfigWhere to look for declared subprocess tools — programs a workspace’s manifest puts on the model’s roster.
shell: ShellAccessWhether 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: StringImplementations§
Source§impl RunConfig
impl RunConfig
pub fn new(workspace: impl Into<PathBuf>, prompt: impl Into<String>) -> Self
pub fn with_provider(self, provider: BuiltinProvider) -> Self
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
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.
pub fn with_model(self, model: ModelSelector) -> Self
pub fn with_context(self, context: ContextConfig) -> Self
pub fn with_skills(self, skills: SkillsConfig) -> Self
Sourcepub fn with_mcp(self, mcp: McpConfig) -> Self
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.
pub fn with_templates(self, templates: TemplatesConfig) -> Self
Sourcepub fn with_hooks(self, hooks: HooksConfig) -> Self
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.
Sourcepub fn with_tools(self, tools: ToolsConfig) -> Self
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.
Sourcepub fn with_shell(self, shell: ShellAccess) -> Self
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.
Sourcepub fn with_effort(self, effort: Effort) -> Self
pub fn with_effort(self, effort: Effort) -> Self
Asks the model to think harder, where the provider supports it.
pub fn with_session_name(self, session_name: impl Into<String>) -> Self
Sourcepub fn with_deadline(self, deadline: Duration) -> Self
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.
Sourcepub fn with_tool_budget(self, tool_budget: usize) -> Self
pub fn with_tool_budget(self, tool_budget: usize) -> Self
Caps how many tool calls the run may make.
Sourcepub fn with_token_budget(self, token_budget: u64) -> Self
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.
Sourcepub fn turn_options(&self) -> TurnOptions
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.
Sourcepub fn split(&self) -> (WorkspaceBuilder, RunSpec)
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.