Skip to main content

OptionsBuilder

Struct OptionsBuilder 

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

Builder for constructing Options.

Implementations§

Source§

impl OptionsBuilder

Source

pub fn allowed_tools(self, tools: Vec<String>) -> Self

Source

pub fn disallowed_tools(self, tools: Vec<String>) -> Self

Source

pub fn permission_mode(self, mode: PermissionMode) -> Self

Source

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

Source

pub fn additional_directories(self, dirs: Vec<String>) -> Self

Source

pub fn env_blocklist(self, keys: Vec<String>) -> Self

Source

pub fn pre_exec_fn(self, f: Box<dyn Fn() -> Result<()> + Send + Sync>) -> Self

Set a pre-exec hook for subprocesses (Unix only). Called in the child after fork, before exec. Used for netns isolation.

Source

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

Source

pub fn fallback_model(self, model: impl Into<String>) -> Self

Source

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

Source

pub fn max_turns(self, max_turns: u32) -> Self

Source

pub fn max_budget_usd(self, budget: f64) -> Self

Source

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

Source

pub fn compaction_model(self, model: impl Into<String>) -> Self

Source

pub fn compaction_provider(self, provider: Box<dyn LlmProvider>) -> Self

Source

pub fn system_prompt(self, prompt: SystemPrompt) -> Self

Source

pub fn thinking(self, config: ThinkingConfig) -> Self

Source

pub fn hook(self, event: HookEvent, matchers: Vec<HookCallbackMatcher>) -> Self

Source

pub fn hook_dirs(self, dirs: Vec<PathBuf>) -> Self

Source

pub fn mcp_server( self, name: impl Into<String>, config: McpServerConfig, ) -> Self

Source

pub fn agent(self, name: impl Into<String>, definition: AgentDefinition) -> Self

Source

pub fn continue_session(self, value: bool) -> Self

Source

pub fn resume(self, session_id: impl Into<String>) -> Self

Source

pub fn session_id(self, id: impl Into<String>) -> Self

Source

pub fn fork_session(self, value: bool) -> Self

Source

pub fn setting_sources(self, sources: Vec<SettingSource>) -> Self

Source

pub fn debug(self, value: bool) -> Self

Source

pub fn include_partial_messages(self, value: bool) -> Self

Source

pub fn persist_session(self, value: bool) -> Self

Source

pub fn enable_file_checkpointing(self, value: bool) -> Self

Source

pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self

Source

pub fn output_format(self, schema: Value) -> Self

Source

pub fn sandbox(self, settings: SandboxSettings) -> Self

Source

pub fn external_tool_handler(self, handler: ExternalToolHandlerFn) -> Self

Source

pub fn custom_tool(self, def: CustomToolDefinition) -> Self

Source

pub fn custom_tools(self, defs: Vec<CustomToolDefinition>) -> Self

Source

pub fn followup_rx(self, rx: UnboundedReceiver<String>) -> Self

Source

pub fn api_key(self, key: impl Into<String>) -> Self

Source

pub fn attachments(self, attachments: Vec<QueryAttachment>) -> Self

Source

pub fn provider(self, provider: Box<dyn LlmProvider>) -> Self

Source

pub fn pre_compact_handler(self, handler: PreCompactHandlerFn) -> Self

Source

pub fn max_tokens(self, max_tokens: u32) -> Self

Source

pub fn summary_max_tokens(self, tokens: u32) -> Self

Source

pub fn min_keep_messages(self, count: usize) -> Self

Source

pub fn max_tool_result_bytes(self, bytes: usize) -> Self

Source

pub fn prune_threshold_pct(self, pct: u8) -> Self

Source

pub fn prune_tool_result_max_chars(self, chars: usize) -> Self

Source

pub fn build(self) -> Options

Trait Implementations§

Source§

impl Default for OptionsBuilder

Source§

fn default() -> OptionsBuilder

Returns the “default value” for a type. 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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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