claude_code/types.rs
1//! Core data types for the Claude Code SDK.
2//!
3//! This module defines all the configuration, message, and permission types used
4//! throughout the SDK. These types correspond to the Python SDK's type definitions
5//! documented at <https://platform.claude.com/docs/en/agent-sdk/python>.
6
7use std::collections::HashMap;
8use std::path::PathBuf;
9use std::sync::Arc;
10
11use futures::future::BoxFuture;
12use serde::{Deserialize, Serialize};
13use serde_json::Value;
14
15use crate::errors::Error;
16use crate::sdk_mcp::McpSdkServer;
17
18/// Permission mode controlling how Claude Code handles tool execution permissions.
19///
20/// Corresponds to the Python SDK's `PermissionMode` literal type.
21///
22/// # Variants
23///
24/// - `Default` — Standard permission behavior; Claude prompts for approval on sensitive operations.
25/// - `AcceptEdits` — Auto-accept file edits without prompting.
26/// - `Plan` — Planning mode; Claude describes actions without executing them.
27/// - `BypassPermissions` — Bypass all permission checks. **Use with caution.**
28#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
29pub enum PermissionMode {
30 /// Standard permission behavior with interactive approval when needed.
31 #[serde(rename = "default")]
32 Default,
33 /// Auto-accept file edits without interactive approval.
34 #[serde(rename = "acceptEdits")]
35 AcceptEdits,
36 /// Planning mode where the model proposes actions instead of executing them.
37 #[serde(rename = "plan")]
38 Plan,
39 /// Bypass all permission checks.
40 #[serde(rename = "bypassPermissions")]
41 BypassPermissions,
42}
43
44/// Controls which filesystem-based configuration sources the SDK loads settings from.
45///
46/// When `setting_sources` is omitted or `None` in [`ClaudeAgentOptions`], the SDK does
47/// **not** load any filesystem settings, providing isolation for SDK applications.
48///
49/// # Variants
50///
51/// - `User` — Global user settings (`~/.claude/settings.json`).
52/// - `Project` — Shared project settings (`.claude/settings.json`), version controlled.
53/// Must be included to load `CLAUDE.md` files.
54/// - `Local` — Local project settings (`.claude/settings.local.json`), typically gitignored.
55///
56/// # Precedence
57///
58/// When multiple sources are loaded, settings merge with this precedence (highest first):
59/// 1. Local settings
60/// 2. Project settings
61/// 3. User settings
62///
63/// Programmatic options (e.g., `agents`, `allowed_tools`) always override filesystem settings.
64#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
65#[serde(rename_all = "camelCase")]
66pub enum SettingSource {
67 /// Load user-level settings from the home directory.
68 User,
69 /// Load project-level shared settings.
70 Project,
71 /// Load local project settings (typically not committed).
72 Local,
73}
74
75/// Preset configuration for the system prompt.
76///
77/// Uses Claude Code's built-in system prompt with an optional appended section.
78///
79/// # Fields
80///
81/// - `type_` — Must be `"preset"`.
82/// - `preset` — Must be `"claude_code"` to use Claude Code's system prompt.
83/// - `append` — Optional additional instructions to append to the preset system prompt.
84#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
85pub struct SystemPromptPreset {
86 /// Discriminator field for preset prompts (typically `"preset"`).
87 #[serde(rename = "type")]
88 pub type_: String,
89 /// Preset name (typically `"claude_code"`).
90 pub preset: String,
91 /// Extra instructions appended to the preset prompt.
92 #[serde(skip_serializing_if = "Option::is_none")]
93 pub append: Option<String>,
94}
95
96impl Default for SystemPromptPreset {
97 fn default() -> Self {
98 Self {
99 type_: "preset".to_string(),
100 preset: "claude_code".to_string(),
101 append: None,
102 }
103 }
104}
105
106/// Preset tools configuration for using Claude Code's default tool set.
107///
108/// # Fields
109///
110/// - `type_` — Must be `"preset"`.
111/// - `preset` — Must be `"claude_code"` for the default tool set.
112#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
113pub struct ToolsPreset {
114 /// Discriminator field for preset tools (typically `"preset"`).
115 #[serde(rename = "type")]
116 pub type_: String,
117 /// Preset name (typically `"claude_code"`).
118 pub preset: String,
119}
120
121impl Default for ToolsPreset {
122 fn default() -> Self {
123 Self {
124 type_: "preset".to_string(),
125 preset: "claude_code".to_string(),
126 }
127 }
128}
129
130/// System prompt configuration.
131///
132/// Either provide a custom text prompt or use Claude Code's preset system prompt.
133///
134/// # Variants
135///
136/// - `Text` — A custom system prompt string.
137/// - `Preset` — Use Claude Code's built-in system prompt via [`SystemPromptPreset`].
138#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
139#[serde(untagged)]
140pub enum SystemPrompt {
141 /// Use a custom system prompt string.
142 Text(String),
143 /// Use Claude Code's preset system prompt.
144 Preset(SystemPromptPreset),
145}
146
147/// Tools configuration.
148///
149/// Either provide an explicit list of tool names or use Claude Code's preset tools.
150///
151/// # Variants
152///
153/// - `List` — An explicit list of tool name strings.
154/// - `Preset` — Use Claude Code's default tool set via [`ToolsPreset`].
155#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
156#[serde(untagged)]
157pub enum ToolsOption {
158 /// Explicit list of allowed tool names.
159 List(Vec<String>),
160 /// Use the default Claude Code tools preset.
161 Preset(ToolsPreset),
162}
163
164/// Configuration for a programmatically defined subagent.
165///
166/// Subagents are specialized agents that can be invoked by the main Claude Code agent
167/// for specific tasks.
168///
169/// # Fields
170///
171/// - `description` — Natural language description of when to use this agent.
172/// - `prompt` — The agent's system prompt.
173/// - `tools` — Optional list of allowed tool names. If omitted, inherits all tools.
174/// - `model` — Optional model override (e.g., `"sonnet"`, `"opus"`, `"haiku"`, `"inherit"`).
175/// If omitted, uses the main model.
176#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
177pub struct AgentDefinition {
178 /// Human-readable description of when this agent should be used.
179 pub description: String,
180 /// The sub-agent system prompt.
181 pub prompt: String,
182 /// Optional tool allowlist for this sub-agent.
183 #[serde(skip_serializing_if = "Option::is_none")]
184 pub tools: Option<Vec<String>>,
185 /// Optional model override for this sub-agent.
186 #[serde(skip_serializing_if = "Option::is_none")]
187 pub model: Option<String>,
188}
189
190/// A rule to add, replace, or remove in a permission update.
191///
192/// # Fields
193///
194/// - `tool_name` — The name of the tool this rule applies to.
195/// - `rule_content` — Optional rule content string (e.g., a glob pattern or path).
196#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
197#[serde(rename_all = "camelCase")]
198pub struct PermissionRuleValue {
199 /// Tool name that this rule applies to.
200 pub tool_name: String,
201 /// Optional rule body (for example a path or glob).
202 #[serde(skip_serializing_if = "Option::is_none")]
203 pub rule_content: Option<String>,
204}
205
206/// Destination for applying a permission update.
207///
208/// Determines where the permission change is persisted.
209#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
210#[serde(rename_all = "camelCase")]
211pub enum PermissionUpdateDestination {
212 /// Persist update to user settings.
213 UserSettings,
214 /// Persist update to project settings.
215 ProjectSettings,
216 /// Persist update to local project settings.
217 LocalSettings,
218 /// Apply update only for the current session.
219 Session,
220}
221
222/// Behavior for rule-based permission operations.
223#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
224#[serde(rename_all = "lowercase")]
225pub enum PermissionBehavior {
226 /// Explicitly allow matching operations.
227 Allow,
228 /// Explicitly deny matching operations.
229 Deny,
230 /// Ask for confirmation on matching operations.
231 Ask,
232}
233
234/// The type of a permission update operation.
235#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
236#[serde(rename_all = "camelCase")]
237pub enum PermissionUpdateType {
238 /// Add permission rules to the existing set.
239 AddRules,
240 /// Replace all existing rules with the provided rules.
241 ReplaceRules,
242 /// Remove matching rules from the existing set.
243 RemoveRules,
244 /// Set the current permission mode.
245 SetMode,
246 /// Add directories to the permission scope.
247 AddDirectories,
248 /// Remove directories from the permission scope.
249 RemoveDirectories,
250}
251
252/// Configuration for updating permissions programmatically.
253///
254/// Used to modify permission rules, change modes, or manage directory access
255/// during a session.
256///
257/// # Fields
258///
259/// - `type_` — The type of permission update operation.
260/// - `rules` — Rules for add/replace/remove operations.
261/// - `behavior` — Behavior for rule-based operations (`"allow"`, `"deny"`, `"ask"`).
262/// - `mode` — Mode for `SetMode` operations.
263/// - `directories` — Directories for add/remove directory operations.
264/// - `destination` — Where to apply the permission update.
265#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
266pub struct PermissionUpdate {
267 /// Operation type to apply.
268 #[serde(rename = "type")]
269 pub type_: PermissionUpdateType,
270 /// Rule set used by rule-based updates.
271 #[serde(skip_serializing_if = "Option::is_none")]
272 pub rules: Option<Vec<PermissionRuleValue>>,
273 /// Behavior used by rule-based updates.
274 #[serde(skip_serializing_if = "Option::is_none")]
275 pub behavior: Option<PermissionBehavior>,
276 /// Permission mode used by `SetMode`.
277 #[serde(skip_serializing_if = "Option::is_none")]
278 pub mode: Option<PermissionMode>,
279 /// Directory paths used by directory updates.
280 #[serde(skip_serializing_if = "Option::is_none")]
281 pub directories: Option<Vec<String>>,
282 /// Where this update should be persisted/applied.
283 #[serde(skip_serializing_if = "Option::is_none")]
284 pub destination: Option<PermissionUpdateDestination>,
285}
286
287impl PermissionUpdate {
288 /// Converts this permission update to a JSON value suitable for the CLI protocol.
289 ///
290 /// # Example
291 ///
292 /// ```rust
293 /// use claude_code::{PermissionUpdate};
294 /// use claude_code::types::{PermissionBehavior, PermissionRuleValue, PermissionUpdateType};
295 ///
296 /// let update = PermissionUpdate {
297 /// type_: PermissionUpdateType::AddRules,
298 /// rules: Some(vec![PermissionRuleValue {
299 /// tool_name: "Bash".to_string(),
300 /// rule_content: Some("git status".to_string()),
301 /// }]),
302 /// behavior: Some(PermissionBehavior::Allow),
303 /// mode: None,
304 /// directories: None,
305 /// destination: None,
306 /// };
307 ///
308 /// let json = update.to_cli_dict();
309 /// assert_eq!(json["type"], "addRules");
310 /// ```
311 pub fn to_cli_dict(&self) -> Value {
312 let mut result = serde_json::Map::new();
313 result.insert(
314 "type".to_string(),
315 serde_json::to_value(&self.type_).unwrap_or(Value::Null),
316 );
317
318 if let Some(destination) = &self.destination {
319 result.insert(
320 "destination".to_string(),
321 serde_json::to_value(destination).unwrap_or(Value::Null),
322 );
323 }
324
325 match self.type_ {
326 PermissionUpdateType::AddRules
327 | PermissionUpdateType::ReplaceRules
328 | PermissionUpdateType::RemoveRules => {
329 if let Some(rules) = &self.rules {
330 let rules_json: Vec<Value> = rules
331 .iter()
332 .map(|rule| {
333 serde_json::json!({
334 "toolName": rule.tool_name,
335 "ruleContent": rule.rule_content
336 })
337 })
338 .collect();
339 result.insert("rules".to_string(), Value::Array(rules_json));
340 }
341 if let Some(behavior) = &self.behavior {
342 result.insert(
343 "behavior".to_string(),
344 serde_json::to_value(behavior).unwrap_or(Value::Null),
345 );
346 }
347 }
348 PermissionUpdateType::SetMode => {
349 if let Some(mode) = &self.mode {
350 result.insert(
351 "mode".to_string(),
352 serde_json::to_value(mode).unwrap_or(Value::Null),
353 );
354 }
355 }
356 PermissionUpdateType::AddDirectories | PermissionUpdateType::RemoveDirectories => {
357 if let Some(directories) = &self.directories {
358 result.insert(
359 "directories".to_string(),
360 serde_json::to_value(directories).unwrap_or(Value::Null),
361 );
362 }
363 }
364 }
365
366 Value::Object(result)
367 }
368}
369
370/// Context information passed to tool permission callbacks.
371///
372/// Provides additional context when the [`CanUseToolCallback`] is invoked, including
373/// permission update suggestions from the CLI.
374///
375/// # Fields
376///
377/// - `suggestions` — Permission update suggestions from the CLI for the user to consider.
378/// - `blocked_path` — Optional path rejected by permission checks.
379/// - `signal` — Reserved placeholder for future abort signal support.
380#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
381pub struct ToolPermissionContext {
382 /// CLI-suggested permission updates for this tool request.
383 #[serde(default)]
384 pub suggestions: Vec<PermissionUpdate>,
385 /// Optional blocked path associated with the request.
386 #[serde(default, skip_serializing_if = "Option::is_none")]
387 pub blocked_path: Option<String>,
388 /// Reserved signal placeholder for future API compatibility.
389 #[serde(default, skip_serializing_if = "Option::is_none")]
390 pub signal: Option<()>,
391}
392
393/// Result indicating the tool call should be allowed.
394///
395/// Returned from a [`CanUseToolCallback`] to approve tool execution.
396///
397/// # Fields
398///
399/// - `updated_input` — Optional modified input to use instead of the original.
400/// - `updated_permissions` — Optional permission updates to apply alongside this approval.
401#[derive(Debug, Clone, PartialEq, Default)]
402pub struct PermissionResultAllow {
403 /// Optional rewritten tool input payload.
404 pub updated_input: Option<Value>,
405 /// Optional additional permission updates to apply.
406 pub updated_permissions: Option<Vec<PermissionUpdate>>,
407}
408
409/// Result indicating the tool call should be denied.
410///
411/// Returned from a [`CanUseToolCallback`] to reject tool execution.
412///
413/// # Fields
414///
415/// - `message` — Message explaining why the tool was denied.
416/// - `interrupt` — Whether to interrupt the current execution entirely.
417#[derive(Debug, Clone, PartialEq, Default)]
418pub struct PermissionResultDeny {
419 /// Human-readable denial reason.
420 pub message: String,
421 /// Whether processing should be interrupted after denial.
422 pub interrupt: bool,
423}
424
425/// Union type for permission callback results.
426///
427/// Returned by [`CanUseToolCallback`] functions to indicate whether a tool call
428/// should be allowed or denied.
429#[derive(Debug, Clone, PartialEq)]
430pub enum PermissionResult {
431 /// Approve the tool call with optional adjusted input/permissions.
432 Allow(PermissionResultAllow),
433 /// Reject the tool call.
434 Deny(PermissionResultDeny),
435}
436
437/// Callback type for custom tool permission logic.
438///
439/// This function is invoked before each tool execution, receiving:
440/// - `tool_name` (`String`) — The name of the tool being called.
441/// - `input_data` (`Value`) — The tool's input parameters.
442/// - `context` ([`ToolPermissionContext`]) — Additional context including permission suggestions.
443///
444/// Returns a [`PermissionResult`] indicating whether the tool call should be allowed or denied.
445///
446/// # Note
447///
448/// When using `can_use_tool`, the prompt must be provided as streaming messages
449/// (not a plain text string), and `permission_prompt_tool_name` must not be set.
450pub type CanUseToolCallback = Arc<
451 dyn Fn(
452 String,
453 Value,
454 ToolPermissionContext,
455 ) -> BoxFuture<'static, std::result::Result<PermissionResult, Error>>
456 + Send
457 + Sync,
458>;
459
460/// Context information passed to hook callbacks.
461///
462/// Currently a marker type; reserved for future abort signal support.
463#[derive(Debug, Clone, Default)]
464pub struct HookContext;
465
466/// Input data passed to hook callbacks.
467///
468/// A raw JSON value whose structure depends on the hook event type (e.g.,
469/// `PreToolUse`, `PostToolUse`, `UserPromptSubmit`, etc.).
470/// See the [hooks documentation](https://platform.claude.com/docs/en/agent-sdk/hooks)
471/// for the expected shapes per event.
472pub type HookInput = Value;
473
474/// Return value from hook callbacks.
475///
476/// A JSON value that may contain control fields such as:
477/// - `decision` — `"block"` to block the action.
478/// - `systemMessage` — A system message to add to the transcript.
479/// - `hookSpecificOutput` — Hook-specific output data.
480/// - `continue_` — Whether to proceed (maps to `"continue"` in the CLI protocol).
481/// - `async_` — Set to `true` to defer execution (maps to `"async"` in the CLI protocol).
482pub type HookJSONOutput = Value;
483
484/// Callback type for hook functions.
485///
486/// Invoked when a matching hook event occurs. Receives:
487/// - `input` ([`HookInput`]) — Event-specific input data.
488/// - `tool_use_id` (`Option<String>`) — Optional tool use identifier (for tool-related hooks).
489/// - `context` ([`HookContext`]) — Hook context with additional information.
490///
491/// Returns a [`HookJSONOutput`] JSON value with optional control and output fields.
492pub type HookCallback = Arc<
493 dyn Fn(
494 HookInput,
495 Option<String>,
496 HookContext,
497 ) -> BoxFuture<'static, std::result::Result<HookJSONOutput, Error>>
498 + Send
499 + Sync,
500>;
501
502/// Configuration for matching hooks to specific events or tools.
503///
504/// # Fields
505///
506/// - `matcher` — Optional tool name or regex pattern to match (e.g., `"Bash"`, `"Write|Edit"`).
507/// If `None`, the hook applies to all tools.
508/// - `hooks` — List of callback functions to execute when matched.
509/// - `timeout` — Optional timeout in seconds for all hooks in this matcher (default: 60).
510#[derive(Clone, Default)]
511pub struct HookMatcher {
512 /// Optional matcher expression for selecting hook targets.
513 pub matcher: Option<String>,
514 /// Hook callbacks to execute when this matcher is selected.
515 pub hooks: Vec<HookCallback>,
516 /// Optional timeout in seconds applied to callbacks in this matcher.
517 pub timeout: Option<f64>,
518}
519
520/// Configuration for an MCP server using stdio transport.
521///
522/// Launches an external process and communicates via stdin/stdout.
523///
524/// # Fields
525///
526/// - `type_` — Optional; set to `"stdio"` for explicit typing (backwards compatible if omitted).
527/// - `command` — The command to execute.
528/// - `args` — Optional command-line arguments.
529/// - `env` — Optional environment variables to set.
530#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
531pub struct McpStdioServerConfig {
532 /// Optional discriminator for stdio transport (`"stdio"`).
533 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
534 pub type_: Option<String>,
535 /// Command used to launch the MCP server process.
536 pub command: String,
537 /// Optional command arguments.
538 #[serde(skip_serializing_if = "Option::is_none")]
539 pub args: Option<Vec<String>>,
540 /// Optional environment variables passed to the process.
541 #[serde(skip_serializing_if = "Option::is_none")]
542 pub env: Option<HashMap<String, String>>,
543}
544
545/// Configuration for an MCP server using Server-Sent Events (SSE) transport.
546///
547/// # Fields
548///
549/// - `type_` — Must be `"sse"`.
550/// - `url` — The SSE endpoint URL.
551/// - `headers` — Optional HTTP headers to include in requests.
552#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
553pub struct McpSSEServerConfig {
554 /// Discriminator for SSE transport (`"sse"`).
555 #[serde(rename = "type")]
556 pub type_: String,
557 /// SSE endpoint URL.
558 pub url: String,
559 /// Optional HTTP headers for the SSE connection.
560 #[serde(skip_serializing_if = "Option::is_none")]
561 pub headers: Option<HashMap<String, String>>,
562}
563
564/// Configuration for an MCP server using HTTP transport.
565///
566/// # Fields
567///
568/// - `type_` — Must be `"http"`.
569/// - `url` — The HTTP endpoint URL.
570/// - `headers` — Optional HTTP headers to include in requests.
571#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
572pub struct McpHttpServerConfig {
573 /// Discriminator for HTTP transport (`"http"`).
574 #[serde(rename = "type")]
575 pub type_: String,
576 /// HTTP endpoint URL.
577 pub url: String,
578 /// Optional HTTP headers.
579 #[serde(skip_serializing_if = "Option::is_none")]
580 pub headers: Option<HashMap<String, String>>,
581}
582
583/// Configuration for an in-process SDK MCP server.
584///
585/// Created via [`create_sdk_mcp_server()`](crate::create_sdk_mcp_server). The server
586/// runs within your Rust application and handles tool calls in-process.
587///
588/// # Fields
589///
590/// - `type_` — Always `"sdk"`.
591/// - `name` — Unique name identifier for the server.
592/// - `instance` — Shared reference to the [`McpSdkServer`] instance.
593#[derive(Clone)]
594pub struct McpSdkServerConfig {
595 /// Discriminator for in-process SDK transport (`"sdk"`).
596 pub type_: String,
597 /// Logical server name used in MCP config maps.
598 pub name: String,
599 /// In-process server instance.
600 pub instance: Arc<McpSdkServer>,
601}
602
603/// Union type for MCP server configurations.
604///
605/// Supports four transport types for MCP (Model Context Protocol) servers:
606///
607/// - `Stdio` — External process communicating via stdin/stdout.
608/// - `Sse` — Remote server using Server-Sent Events.
609/// - `Http` — Remote server using HTTP.
610/// - `Sdk` — In-process server running within your application.
611#[derive(Clone)]
612pub enum McpServerConfig {
613 /// External stdio MCP server process.
614 Stdio(McpStdioServerConfig),
615 /// Remote SSE MCP server.
616 Sse(McpSSEServerConfig),
617 /// Remote HTTP MCP server.
618 Http(McpHttpServerConfig),
619 /// In-process SDK MCP server.
620 Sdk(McpSdkServerConfig),
621}
622
623impl McpServerConfig {
624 /// Converts this configuration to a JSON value for the CLI protocol.
625 ///
626 /// SDK-type servers are serialized as `{"type": "sdk", "name": "<name>"}` since
627 /// the actual server instance runs in-process and doesn't need full serialization.
628 ///
629 /// # Example
630 ///
631 /// ```rust
632 /// use claude_code::{McpServerConfig, McpSSEServerConfig};
633 ///
634 /// let config = McpServerConfig::Sse(McpSSEServerConfig {
635 /// type_: "sse".to_string(),
636 /// url: "https://example.com/mcp".to_string(),
637 /// headers: None,
638 /// });
639 ///
640 /// let json = config.to_cli_json();
641 /// assert_eq!(json["type"], "sse");
642 /// ```
643 pub fn to_cli_json(&self) -> Value {
644 match self {
645 McpServerConfig::Stdio(config) => serde_json::to_value(config).unwrap_or(Value::Null),
646 McpServerConfig::Sse(config) => serde_json::to_value(config).unwrap_or(Value::Null),
647 McpServerConfig::Http(config) => serde_json::to_value(config).unwrap_or(Value::Null),
648 McpServerConfig::Sdk(config) => {
649 serde_json::json!({
650 "type": "sdk",
651 "name": config.name
652 })
653 }
654 }
655 }
656}
657
658/// MCP server configuration option for [`ClaudeAgentOptions`].
659///
660/// # Variants
661///
662/// - `None` — No MCP servers configured (default).
663/// - `Servers` — A map of server name to [`McpServerConfig`].
664/// - `Raw` — A raw JSON string or file path to an MCP configuration.
665#[derive(Clone, Default)]
666pub enum McpServersOption {
667 #[default]
668 /// No MCP servers are configured.
669 None,
670 /// Explicit map of server names to server configs.
671 Servers(HashMap<String, McpServerConfig>),
672 /// Raw CLI `--mcp-config` payload (JSON string or path).
673 Raw(String),
674}
675
676/// Configuration for loading plugins in the SDK.
677///
678/// Only local plugins are currently supported.
679///
680/// # Fields
681///
682/// - `type_` — Must be `"local"`.
683/// - `path` — Absolute or relative path to the plugin directory.
684#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
685pub struct SdkPluginConfig {
686 /// Plugin type discriminator (currently `"local"`).
687 #[serde(rename = "type")]
688 pub type_: String,
689 /// Filesystem path to the plugin directory.
690 pub path: String,
691}
692
693/// Network-specific configuration for sandbox mode.
694///
695/// Controls how sandboxed processes can access network resources.
696///
697/// # Fields
698///
699/// - `allow_unix_sockets` — Unix socket paths that processes can access (e.g., Docker socket).
700/// - `allow_all_unix_sockets` — Allow access to all Unix sockets.
701/// - `allow_local_binding` — Allow processes to bind to local ports (e.g., for dev servers).
702/// - `http_proxy_port` — HTTP proxy port for network requests.
703/// - `socks_proxy_port` — SOCKS proxy port for network requests.
704#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
705pub struct SandboxNetworkConfig {
706 /// Allowed unix socket paths.
707 #[serde(rename = "allowUnixSockets", skip_serializing_if = "Option::is_none")]
708 pub allow_unix_sockets: Option<Vec<String>>,
709 /// Whether all unix sockets are allowed.
710 #[serde(
711 rename = "allowAllUnixSockets",
712 skip_serializing_if = "Option::is_none"
713 )]
714 pub allow_all_unix_sockets: Option<bool>,
715 /// Whether local port binding is allowed.
716 #[serde(rename = "allowLocalBinding", skip_serializing_if = "Option::is_none")]
717 pub allow_local_binding: Option<bool>,
718 /// HTTP proxy port exposed into the sandbox.
719 #[serde(rename = "httpProxyPort", skip_serializing_if = "Option::is_none")]
720 pub http_proxy_port: Option<u16>,
721 /// SOCKS proxy port exposed into the sandbox.
722 #[serde(rename = "socksProxyPort", skip_serializing_if = "Option::is_none")]
723 pub socks_proxy_port: Option<u16>,
724}
725
726/// Configuration for ignoring specific sandbox violations.
727///
728/// # Fields
729///
730/// - `file` — File path patterns to ignore violations for.
731/// - `network` — Network patterns to ignore violations for.
732#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
733pub struct SandboxIgnoreViolations {
734 /// File path patterns to ignore.
735 #[serde(skip_serializing_if = "Option::is_none")]
736 pub file: Option<Vec<String>>,
737 /// Network patterns to ignore.
738 #[serde(skip_serializing_if = "Option::is_none")]
739 pub network: Option<Vec<String>>,
740}
741
742/// Sandbox configuration for controlling command execution isolation.
743///
744/// Use this to enable command sandboxing and configure network restrictions
745/// programmatically.
746///
747/// # Fields
748///
749/// - `enabled` — Enable sandbox mode for command execution.
750/// - `auto_allow_bash_if_sandboxed` — Auto-approve bash commands when sandbox is enabled.
751/// - `excluded_commands` — Commands that always bypass sandbox restrictions (e.g., `["docker"]`).
752/// - `allow_unsandboxed_commands` — Allow the model to request running commands outside the sandbox.
753/// - `network` — Network-specific sandbox configuration.
754/// - `ignore_violations` — Configure which sandbox violations to ignore.
755/// - `enable_weaker_nested_sandbox` — Enable a weaker nested sandbox for compatibility.
756#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
757pub struct SandboxSettings {
758 /// Enables or disables sandboxing.
759 #[serde(skip_serializing_if = "Option::is_none")]
760 pub enabled: Option<bool>,
761 /// Auto-approve bash tool when sandboxing is enabled.
762 #[serde(
763 rename = "autoAllowBashIfSandboxed",
764 skip_serializing_if = "Option::is_none"
765 )]
766 pub auto_allow_bash_if_sandboxed: Option<bool>,
767 /// Commands excluded from sandbox restrictions.
768 #[serde(rename = "excludedCommands", skip_serializing_if = "Option::is_none")]
769 pub excluded_commands: Option<Vec<String>>,
770 /// Whether unsandboxed command execution can be requested.
771 #[serde(
772 rename = "allowUnsandboxedCommands",
773 skip_serializing_if = "Option::is_none"
774 )]
775 pub allow_unsandboxed_commands: Option<bool>,
776 /// Network-related sandbox settings.
777 #[serde(skip_serializing_if = "Option::is_none")]
778 pub network: Option<SandboxNetworkConfig>,
779 /// Violation categories to ignore.
780 #[serde(rename = "ignoreViolations", skip_serializing_if = "Option::is_none")]
781 pub ignore_violations: Option<SandboxIgnoreViolations>,
782 /// Enables weaker nested sandbox mode for compatibility.
783 #[serde(
784 rename = "enableWeakerNestedSandbox",
785 skip_serializing_if = "Option::is_none"
786 )]
787 pub enable_weaker_nested_sandbox: Option<bool>,
788}
789
790/// A text content block in an assistant message.
791#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
792pub struct TextBlock {
793 /// Textual content for this block.
794 pub text: String,
795}
796
797/// A thinking content block (for models with extended thinking capability).
798///
799/// Contains the model's internal reasoning and a cryptographic signature.
800#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
801pub struct ThinkingBlock {
802 /// Model-generated reasoning content.
803 pub thinking: String,
804 /// Signature associated with the reasoning block.
805 pub signature: String,
806}
807
808/// A tool use request block.
809///
810/// Represents Claude's request to invoke a specific tool with given parameters.
811///
812/// # Fields
813///
814/// - `id` — Unique identifier for this tool use request.
815/// - `name` — Name of the tool to invoke.
816/// - `input` — JSON input parameters for the tool.
817#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
818pub struct ToolUseBlock {
819 /// Tool use identifier.
820 pub id: String,
821 /// Invoked tool name.
822 pub name: String,
823 /// Tool input payload.
824 pub input: Value,
825}
826
827/// A tool execution result block.
828///
829/// Contains the output from a previously executed tool.
830///
831/// # Fields
832///
833/// - `tool_use_id` — The ID of the [`ToolUseBlock`] this result corresponds to.
834/// - `content` — Optional result content (text or structured data).
835/// - `is_error` — Whether the tool execution resulted in an error.
836#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
837pub struct ToolResultBlock {
838 /// Corresponding tool use identifier.
839 pub tool_use_id: String,
840 /// Optional tool result payload.
841 #[serde(skip_serializing_if = "Option::is_none")]
842 pub content: Option<Value>,
843 /// Whether this tool result represents an error.
844 #[serde(skip_serializing_if = "Option::is_none")]
845 pub is_error: Option<bool>,
846}
847
848/// Union type for all content block types in messages.
849///
850/// Content blocks make up the body of [`AssistantMessage`] and [`UserMessage`] responses.
851#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
852pub enum ContentBlock {
853 /// Plain text content.
854 Text(TextBlock),
855 /// Reasoning content.
856 Thinking(ThinkingBlock),
857 /// Tool invocation request.
858 ToolUse(ToolUseBlock),
859 /// Tool invocation result.
860 ToolResult(ToolResultBlock),
861}
862
863/// User message content — either plain text or structured content blocks.
864#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
865#[serde(untagged)]
866pub enum UserContent {
867 /// Plain string user content.
868 Text(String),
869 /// Structured content blocks.
870 Blocks(Vec<ContentBlock>),
871}
872
873/// A user input message.
874///
875/// # Fields
876///
877/// - `content` — Message content as text or content blocks.
878/// - `uuid` — Optional unique message identifier.
879/// - `parent_tool_use_id` — Tool use ID if this message is a tool result response.
880/// - `tool_use_result` — Tool result data if applicable.
881#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
882pub struct UserMessage {
883 /// User message body.
884 pub content: UserContent,
885 /// Optional message UUID.
886 pub uuid: Option<String>,
887 /// Optional parent tool use identifier.
888 pub parent_tool_use_id: Option<String>,
889 /// Optional embedded tool-use result payload.
890 pub tool_use_result: Option<Value>,
891}
892
893/// An assistant response message with content blocks.
894///
895/// # Fields
896///
897/// - `content` — List of content blocks in the response.
898/// - `model` — The model that generated this response.
899/// - `parent_tool_use_id` — Tool use ID if this is a nested subagent response.
900/// - `error` — Error type string if the response encountered an error
901/// (e.g., `"authentication_failed"`, `"rate_limit"`, `"server_error"`).
902#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
903pub struct AssistantMessage {
904 /// Assistant content blocks.
905 pub content: Vec<ContentBlock>,
906 /// Model identifier used for generation.
907 pub model: String,
908 /// Optional parent tool use identifier.
909 pub parent_tool_use_id: Option<String>,
910 /// Optional error classification string.
911 pub error: Option<String>,
912}
913
914/// A system message with metadata.
915///
916/// # Fields
917///
918/// - `subtype` — The system message subtype identifier.
919/// - `data` — The full raw data of the system message.
920#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
921pub struct SystemMessage {
922 /// System message subtype.
923 pub subtype: String,
924 /// Full raw system payload.
925 pub data: Value,
926}
927
928/// Final result message with cost and usage information.
929///
930/// This is the last message received for a query, containing summary statistics.
931///
932/// # Fields
933///
934/// - `subtype` — The result subtype (e.g., `"success"`, `"error"`).
935/// - `duration_ms` — Total wall-clock duration in milliseconds.
936/// - `duration_api_ms` — Time spent in API calls in milliseconds.
937/// - `is_error` — Whether the query resulted in an error.
938/// - `num_turns` — Number of conversation turns in the query.
939/// - `session_id` — The session identifier.
940/// - `total_cost_usd` — Optional total cost in USD.
941/// - `usage` — Optional token usage breakdown (input_tokens, output_tokens,
942/// cache_creation_input_tokens, cache_read_input_tokens).
943/// - `result` — Optional result text.
944/// - `structured_output` — Optional structured output if `output_format` was configured.
945#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
946pub struct ResultMessage {
947 /// Result subtype.
948 pub subtype: String,
949 /// End-to-end duration in milliseconds.
950 pub duration_ms: i64,
951 /// API-only duration in milliseconds.
952 pub duration_api_ms: i64,
953 /// Indicates whether execution ended in error.
954 pub is_error: bool,
955 /// Number of turns performed.
956 pub num_turns: i64,
957 /// Session identifier.
958 pub session_id: String,
959 /// Optional total cost in USD.
960 pub total_cost_usd: Option<f64>,
961 /// Optional usage summary payload.
962 pub usage: Option<Value>,
963 /// Optional text result.
964 pub result: Option<String>,
965 /// Optional structured output payload.
966 pub structured_output: Option<Value>,
967}
968
969/// Stream event for partial message updates during streaming.
970///
971/// Only received when `include_partial_messages` is set to `true` in [`ClaudeAgentOptions`].
972///
973/// # Fields
974///
975/// - `uuid` — Unique identifier for this event.
976/// - `session_id` — Session identifier.
977/// - `event` — The raw Claude API stream event data.
978/// - `parent_tool_use_id` — Parent tool use ID if this event is from a subagent.
979#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
980pub struct StreamEvent {
981 /// Event identifier.
982 pub uuid: String,
983 /// Session identifier for this event.
984 pub session_id: String,
985 /// Raw stream event payload.
986 pub event: Value,
987 /// Optional parent tool use identifier.
988 pub parent_tool_use_id: Option<String>,
989}
990
991/// Union type of all possible messages from the Claude Code CLI.
992///
993/// When receiving messages via [`ClaudeSdkClient::receive_message()`](crate::ClaudeSdkClient::receive_message)
994/// or iterating results from [`query()`](crate::query_fn::query), each message will be one of these variants.
995#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
996pub enum Message {
997 /// A user input message echoed back.
998 User(UserMessage),
999 /// An assistant response with content blocks.
1000 Assistant(AssistantMessage),
1001 /// A system notification or status message.
1002 System(SystemMessage),
1003 /// The final result message with cost/usage information.
1004 Result(ResultMessage),
1005 /// A partial streaming event (only when `include_partial_messages` is enabled).
1006 StreamEvent(StreamEvent),
1007}
1008
1009/// Controls extended thinking behavior.
1010///
1011/// Extended thinking allows Claude to reason through complex problems before responding.
1012///
1013/// # Variants
1014///
1015/// - `Adaptive` — Claude adaptively decides when and how much to think.
1016/// - `Enabled { budget_tokens }` — Enable thinking with a specific token budget.
1017/// - `Disabled` — Disable extended thinking entirely.
1018#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
1019#[serde(tag = "type")]
1020pub enum ThinkingConfig {
1021 /// Let Claude pick thinking depth adaptively.
1022 #[serde(rename = "adaptive")]
1023 Adaptive,
1024 /// Enable explicit thinking with a fixed token budget.
1025 #[serde(rename = "enabled")]
1026 Enabled {
1027 /// Maximum reasoning token budget when thinking is enabled.
1028 budget_tokens: i64,
1029 },
1030 /// Disable thinking blocks.
1031 #[serde(rename = "disabled")]
1032 Disabled,
1033}
1034
1035/// MCP tool annotations providing hints about tool behavior.
1036///
1037/// These annotations help Claude and the system understand tool characteristics
1038/// for better permission handling and execution planning.
1039///
1040/// # Fields
1041///
1042/// - `read_only_hint` — Whether the tool only reads data without side effects.
1043/// - `destructive_hint` — Whether the tool performs destructive operations.
1044/// - `idempotent_hint` — Whether calling the tool multiple times has the same effect as once.
1045/// - `open_world_hint` — Whether the tool interacts with external systems.
1046#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
1047#[serde(rename_all = "camelCase")]
1048pub struct ToolAnnotations {
1049 /// Hint that the tool is read-only.
1050 #[serde(skip_serializing_if = "Option::is_none")]
1051 pub read_only_hint: Option<bool>,
1052 /// Hint that the tool may be destructive.
1053 #[serde(skip_serializing_if = "Option::is_none")]
1054 pub destructive_hint: Option<bool>,
1055 /// Hint that repeated calls have same effect.
1056 #[serde(skip_serializing_if = "Option::is_none")]
1057 pub idempotent_hint: Option<bool>,
1058 /// Hint that the tool interacts with external/open systems.
1059 #[serde(skip_serializing_if = "Option::is_none")]
1060 pub open_world_hint: Option<bool>,
1061}
1062
1063/// Main configuration for Claude Code queries and sessions.
1064///
1065/// This is the primary configuration struct passed to [`query()`](crate::query_fn::query) or
1066/// [`ClaudeSdkClient::new()`](crate::ClaudeSdkClient::new). All fields are optional
1067/// and have sensible defaults.
1068///
1069/// Corresponds to the Python SDK's `ClaudeAgentOptions` dataclass.
1070///
1071/// # Fields
1072///
1073/// | Field | Description |
1074/// |-------|-------------|
1075/// | `tools` | Tools configuration — explicit list or preset |
1076/// | `allowed_tools` | List of allowed tool names |
1077/// | `system_prompt` | System prompt — custom text or preset |
1078/// | `mcp_servers` | MCP server configurations |
1079/// | `permission_mode` | Permission mode for tool usage |
1080/// | `continue_conversation` | Continue the most recent conversation |
1081/// | `resume` | Session ID to resume |
1082/// | `max_turns` | Maximum conversation turns |
1083/// | `max_budget_usd` | Maximum budget in USD for the session |
1084/// | `disallowed_tools` | List of disallowed tool names |
1085/// | `model` | Claude model to use |
1086/// | `fallback_model` | Fallback model if the primary fails |
1087/// | `betas` | Beta features to enable |
1088/// | `permission_prompt_tool_name` | MCP tool name for permission prompts |
1089/// | `cwd` | Current working directory |
1090/// | `cli_path` | Custom path to the Claude Code CLI executable |
1091/// | `settings` | Path to settings file or inline JSON |
1092/// | `add_dirs` | Additional directories Claude can access |
1093/// | `env` | Environment variables |
1094/// | `extra_args` | Additional CLI arguments |
1095/// | `max_buffer_size` | Maximum bytes when buffering CLI stdout |
1096/// | `can_use_tool` | Tool permission callback function |
1097/// | `hooks` | Hook configurations for intercepting events |
1098/// | `user` | User identifier |
1099/// | `include_partial_messages` | Include [`StreamEvent`] partial messages |
1100/// | `fork_session` | Fork to new session ID when resuming |
1101/// | `agents` | Programmatically defined subagents |
1102/// | `setting_sources` | Which filesystem settings to load |
1103/// | `sandbox` | Sandbox configuration |
1104/// | `strict_settings_merge` | Fail instead of warn when sandbox/settings JSON merge fails |
1105/// | `plugins` | Local plugins to load |
1106/// | `max_thinking_tokens` | *Deprecated:* use `thinking` instead |
1107/// | `thinking` | Extended thinking configuration |
1108/// | `effort` | Effort level (`"low"`, `"medium"`, `"high"`, `"max"`) |
1109/// | `output_format` | Structured output format (e.g., JSON schema) |
1110/// | `enable_file_checkpointing` | Enable file change tracking for rewinding |
1111#[derive(Clone)]
1112pub struct ClaudeAgentOptions {
1113 /// Tools configuration. Use [`ToolsOption::Preset`] with [`ToolsPreset::default()`]
1114 /// for Claude Code's default tools.
1115 pub tools: Option<ToolsOption>,
1116 /// List of allowed tool names.
1117 pub allowed_tools: Vec<String>,
1118 /// System prompt configuration. Pass a string via [`SystemPrompt::Text`] for a custom
1119 /// prompt, or use [`SystemPrompt::Preset`] for Claude Code's built-in system prompt.
1120 pub system_prompt: Option<SystemPrompt>,
1121 /// MCP server configurations or path to config file.
1122 pub mcp_servers: McpServersOption,
1123 /// Permission mode for tool usage.
1124 pub permission_mode: Option<PermissionMode>,
1125 /// Continue the most recent conversation.
1126 pub continue_conversation: bool,
1127 /// Session ID to resume.
1128 pub resume: Option<String>,
1129 /// Maximum conversation turns.
1130 pub max_turns: Option<i64>,
1131 /// Maximum budget in USD for the session.
1132 pub max_budget_usd: Option<f64>,
1133 /// List of disallowed tool names.
1134 pub disallowed_tools: Vec<String>,
1135 /// Claude model to use (e.g., `"sonnet"`, `"opus"`).
1136 pub model: Option<String>,
1137 /// Fallback model to use if the primary model fails.
1138 pub fallback_model: Option<String>,
1139 /// Beta features to enable.
1140 pub betas: Vec<String>,
1141 /// MCP tool name for permission prompts. Mutually exclusive with `can_use_tool`.
1142 pub permission_prompt_tool_name: Option<String>,
1143 /// Current working directory for the Claude Code process.
1144 pub cwd: Option<PathBuf>,
1145 /// Custom path to the Claude Code CLI executable.
1146 pub cli_path: Option<PathBuf>,
1147 /// Path to settings file or inline JSON string.
1148 pub settings: Option<String>,
1149 /// Additional directories Claude can access.
1150 pub add_dirs: Vec<PathBuf>,
1151 /// Environment variables to pass to the CLI process.
1152 pub env: HashMap<String, String>,
1153 /// Additional CLI arguments to pass directly to the CLI.
1154 /// Keys are flag names (without `--`), values are optional flag values.
1155 pub extra_args: HashMap<String, Option<String>>,
1156 /// Maximum bytes when buffering CLI stdout. Defaults to 1MB.
1157 pub max_buffer_size: Option<usize>,
1158 /// Custom tool permission callback function.
1159 pub can_use_tool: Option<CanUseToolCallback>,
1160 /// Hook configurations for intercepting events. Keys are hook event names
1161 /// (e.g., `"PreToolUse"`, `"PostToolUse"`, `"UserPromptSubmit"`).
1162 pub hooks: Option<HashMap<String, Vec<HookMatcher>>>,
1163 /// User identifier.
1164 pub user: Option<String>,
1165 /// Include partial message streaming events ([`StreamEvent`]).
1166 pub include_partial_messages: bool,
1167 /// When resuming with `resume`, fork to a new session ID instead of continuing
1168 /// the original session.
1169 pub fork_session: bool,
1170 /// Programmatically defined subagents.
1171 pub agents: Option<HashMap<String, AgentDefinition>>,
1172 /// Control which filesystem settings to load.
1173 /// When omitted, no settings are loaded (SDK isolation).
1174 pub setting_sources: Option<Vec<SettingSource>>,
1175 /// Sandbox configuration for command execution isolation.
1176 pub sandbox: Option<SandboxSettings>,
1177 /// When `true`, fail command construction if sandbox merge with `settings` fails.
1178 /// When `false`, merge failures emit a warning and fallback to sandbox-only settings.
1179 pub strict_settings_merge: bool,
1180 /// Local plugins to load.
1181 pub plugins: Vec<SdkPluginConfig>,
1182 /// *Deprecated:* Maximum tokens for thinking blocks. Use `thinking` instead.
1183 pub max_thinking_tokens: Option<i64>,
1184 /// Extended thinking configuration. Takes precedence over `max_thinking_tokens`.
1185 pub thinking: Option<ThinkingConfig>,
1186 /// Effort level for thinking depth (`"low"`, `"medium"`, `"high"`, `"max"`).
1187 pub effort: Option<String>,
1188 /// Output format for structured responses.
1189 /// Example: `{"type": "json_schema", "schema": {...}}`
1190 pub output_format: Option<Value>,
1191 /// Enable file change tracking for rewinding via
1192 /// [`ClaudeSdkClient::rewind_files()`](crate::ClaudeSdkClient::rewind_files).
1193 pub enable_file_checkpointing: bool,
1194 /// Optional callback for stderr output lines from the CLI process.
1195 ///
1196 /// When set, stderr is piped and each non-empty line is passed to this callback.
1197 /// When `None`, stderr is still drained to prevent subprocess blocking, but
1198 /// lines are discarded.
1199 pub stderr: Option<StderrCallback>,
1200}
1201
1202/// Callback type for receiving stderr output lines from the CLI process.
1203pub type StderrCallback = Arc<dyn Fn(String) + Send + Sync>;
1204
1205impl Default for ClaudeAgentOptions {
1206 fn default() -> Self {
1207 Self {
1208 tools: None,
1209 allowed_tools: Vec::new(),
1210 system_prompt: None,
1211 mcp_servers: McpServersOption::None,
1212 permission_mode: None,
1213 continue_conversation: false,
1214 resume: None,
1215 max_turns: None,
1216 max_budget_usd: None,
1217 disallowed_tools: Vec::new(),
1218 model: None,
1219 fallback_model: None,
1220 betas: Vec::new(),
1221 permission_prompt_tool_name: None,
1222 cwd: None,
1223 cli_path: None,
1224 settings: None,
1225 add_dirs: Vec::new(),
1226 env: HashMap::new(),
1227 extra_args: HashMap::new(),
1228 max_buffer_size: None,
1229 can_use_tool: None,
1230 hooks: None,
1231 user: None,
1232 include_partial_messages: false,
1233 fork_session: false,
1234 agents: None,
1235 setting_sources: None,
1236 sandbox: None,
1237 strict_settings_merge: false,
1238 plugins: Vec::new(),
1239 max_thinking_tokens: None,
1240 thinking: None,
1241 effort: None,
1242 output_format: None,
1243 enable_file_checkpointing: false,
1244 stderr: None,
1245 }
1246 }
1247}