Skip to main content

ClaudeAgentOptionsBuilder

Struct ClaudeAgentOptionsBuilder 

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

Builder for ClaudeAgentOptions

Implementations§

Source§

impl ClaudeAgentOptionsBuilder

Source

pub fn new() -> Self

Source

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

Source

pub fn tools_preset(self, preset: ToolsPreset) -> Self

Source

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

Source

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

Source

pub fn system_prompt_preset(self, preset: SystemPromptPreset) -> Self

Source

pub fn system_prompt_file(self, file: SystemPromptFile) -> Self

Source

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

Source

pub fn sdk_mcp_server( self, name: impl Into<String>, server: SimpleMCPServer, ) -> Self

Source

pub fn mcp_servers(self, servers: HashMap<String, MCPServerConfig>) -> Self

Source

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

Source

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

Source

pub fn continue_conversation(self, continue_conv: bool) -> Self

Source

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

Source

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

Source

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

Source

pub fn max_turns(self, turns: i32) -> Self

Source

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

Source

pub fn task_budget(self, budget: TaskBudget) -> Self

Source

pub fn task_budget_total(self, total: i32) -> Self

Source

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

Source

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

Source

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

Source

pub fn betas(self, betas: Vec<SdkBeta>) -> Self

Source

pub fn add_beta(self, beta: SdkBeta) -> Self

Source

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

Source

pub fn can_use_tool<F, Fut>(self, callback: F) -> Self
where F: Fn(String, Map<String, Value>, ToolPermissionContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<PermissionResult>> + Send + 'static,

Source

pub fn hook(self, event: impl Into<String>, matcher: HookMatcher) -> Self

Source

pub fn hooks(self, hooks: HookMap) -> Self

Source

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

Source

pub fn agents(self, agents: HashMap<String, AgentDefinition>) -> Self

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn env(self, env: HashMap<String, String>) -> Self

Source

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

Source

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

Source

pub fn max_buffer_size(self, size: usize) -> Self

Source

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

Source

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

Source

pub fn include_hook_events(self, include: bool) -> Self

Source

pub fn strict_mcp_config(self, strict: bool) -> Self

Source

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

Source

pub fn add_setting_source(self, source: SettingSource) -> Self

Source

pub fn skills_all(self) -> Self

Source

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

Source

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

Source

pub fn plugin(self, plugin: SDKPluginConfig) -> Self

Source

pub fn plugins(self, plugins: Vec<SDKPluginConfig>) -> Self

Source

pub fn max_thinking_tokens(self, tokens: i32) -> Self

Source

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

Source

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

Source

pub fn output_format(self, format: Map<String, Value>) -> Self

Source

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

Source

pub fn stderr<F>(self, callback: F) -> Self
where F: Fn(String) + Send + Sync + 'static,

Source

pub fn session_store<S>(self, store: S) -> Self
where S: SessionStore + 'static,

Source

pub fn session_store_handle(self, store: SessionStoreHandle) -> Self

Source

pub fn session_store_flush(self, mode: SessionStoreFlushMode) -> Self

Source

pub fn load_timeout_ms(self, timeout_ms: i32) -> Self

Source

pub fn build(self) -> ClaudeAgentOptions

Trait Implementations§

Source§

impl Debug for ClaudeAgentOptionsBuilder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ClaudeAgentOptionsBuilder

Source§

fn default() -> ClaudeAgentOptionsBuilder

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<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