pub struct Options { /* private fields */ }Expand description
The options a session starts (or resumes) with. Every field left unset takes R2.2’s default, which switches off everything personal.
Implementations§
Source§impl Options
impl Options
Sourcepub fn plain(system_prompt: impl Into<String>) -> Self
pub fn plain(system_prompt: impl Into<String>) -> Self
An agent that is not a coding agent (R4): no built-in tools, and
system_prompt in place of harness’s own.
Sourcepub fn thinking(self, thinking: impl Into<String>) -> Self
pub fn thinking(self, thinking: impl Into<String>) -> Self
The thinking level, as --thinking takes it.
Sourcepub fn builtin_tools<I, S>(self, names: I) -> Self
pub fn builtin_tools<I, S>(self, names: I) -> Self
The most built-in tools the session ever offers (R2.2.3); empty offers none.
Sourcepub fn system_prompt(self, prompt: SystemPrompt) -> Self
pub fn system_prompt(self, prompt: SystemPrompt) -> Self
The system prompt policy (R2.3).
Sourcepub fn project_instructions(self, on: bool) -> Self
pub fn project_instructions(self, on: bool) -> Self
Read the project’s AGENTS.md / CLAUDE.md.
Sourcepub fn user_config(self, on: bool) -> Self
pub fn user_config(self, on: bool) -> Self
Read the user’s own setup (config, account, saved model).
Sourcepub fn mcp_server(self, name: impl Into<String>, server: Value) -> Self
pub fn mcp_server(self, name: impl Into<String>, server: Value) -> Self
One MCP server for the session, in the [mcp.servers] table’s shape
as JSON.
Sourcepub fn approval_timeout(self, timeout: Option<Duration>) -> Self
pub fn approval_timeout(self, timeout: Option<Duration>) -> Self
How long an approval request waits for an answer; None waits for
ever. Sent in whole seconds, rounded up, at least one.
Sourcepub fn allow_escapes(self, on: bool) -> Self
pub fn allow_escapes(self, on: bool) -> Self
As --allow-escapes.
Sourcepub fn max_iterations(self, n: u32) -> Self
pub fn max_iterations(self, n: u32) -> Self
As --max-iterations.
Sourcepub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Self
pub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Self
A variable added to the session’s environment.
Sourcepub fn mock(self, path: impl Into<PathBuf>) -> Self
pub fn mock(self, path: impl Into<PathBuf>) -> Self
Answer the model from this mock file, with no key and no network (R5).
Sourcepub fn tool(self, tool: Tool) -> Self
pub fn tool(self, tool: Tool) -> Self
A tool the program runs (R8.4), offered to the model after the built-in tools, in the order added.
Sourcepub fn on_approval<F, Fut>(self, callback: F) -> Self
pub fn on_approval<F, Fut>(self, callback: F) -> Self
Answers every approval request with callback’s decision (R8.3.2);
the requests are then not yielded as events. A callback that panics,
or returns a decision not among the request’s choices, answers
Deny with the failure as the reason.