ClaudeAgentOptions
Configuration dataclass for customizing Claude Agent SDK behavior. Used with bothquery() and ClaudeSDKClient to control models, tools, permissions, hooks, and more.
Fields
list[str] | ToolsPreset | None
default:"None"
List of tool names to enable, or a preset configuration.Example:
["Bash", "Read", "Write"] or {"type": "preset", "preset": "claude_code"}list[str]
default:"[]"
Additional tools to allow beyond the default set.
list[str]
default:"[]"
Tools to explicitly disallow.
str | SystemPromptPreset | None
default:"None"
Custom system prompt or preset configuration.Example:
"You are a helpful coding assistant" or {"type": "preset", "preset": "claude_code", "append": "Additional instructions"}dict[str, McpServerConfig] | str | Path
default:"{}"
MCP server configurations. Can be a dictionary of server configs, or a path to a config file.See MCP Types for configuration details.
PermissionMode | None
default:"None"
Permission mode for tool usage.
"default"- Prompt for permission on potentially dangerous operations"acceptEdits"- Auto-approve file edits"plan"- Review agent’s plan before execution"bypassPermissions"- Skip all permission checks (use with caution)
str | None
default:"None"
Claude model to use (e.g.,
"claude-sonnet-4-20250514", "claude-opus-4-20250514").str | None
default:"None"
Fallback model if the primary model is unavailable.
list[SdkBeta]
default:"[]"
Beta features to enable. See Anthropic API beta headers.Available:
["context-1m-2025-08-07"]int | None
default:"None"
Maximum number of conversation turns before stopping.
float | None
default:"None"
Maximum budget in USD for the session.
bool
default:"False"
Whether to continue an existing conversation session.
str | None
default:"None"
Session ID to resume from.
bool
default:"False"
When true, resumed sessions will fork to a new session ID rather than continuing the previous session.
str | Path | None
default:"None"
Working directory for the session.
str | Path | None
default:"None"
Custom path to the Claude Code CLI executable.
str | None
default:"None"
Path to settings file.
list[SettingSource] | None
default:"None"
Setting sources to load:
["user", "project", "local"]list[str | Path]
default:"[]"
Additional directories to add to the workspace context.
dict[str, str]
default:"{}"
Environment variables for the CLI process.
dict[str, str | None]
default:"{}"
Arbitrary CLI flags to pass through.
CanUseTool | None
default:"None"
Callback function for tool permission requests.
dict[HookEvent, list[HookMatcher]] | None
default:"None"
Hook configurations for lifecycle events.See Hook Types for details.
dict[str, AgentDefinition] | None
default:"None"
Custom agent definitions.
str | None
default:"None"
User identifier for the session.
bool
default:"False"
Enable streaming of partial message updates via
StreamEvent messages.int | None
default:"None"
Maximum bytes when buffering CLI stdout.
Callable[[str], None] | None
default:"None"
Callback for stderr output from CLI.
str | None
default:"None"
Tool name to use for permission prompts.
SandboxSettings | None
default:"None"
Sandbox configuration for bash command isolation.
list[SdkPluginConfig]
default:"[]"
Plugin configurations.
ThinkingConfig | None
default:"None"
Extended thinking configuration.
{"type": "adaptive"}- Adaptive thinking budget{"type": "enabled", "budget_tokens": 10000}- Fixed token budget{"type": "disabled"}- Disable extended thinking
int | None
default:"None"
Deprecated: Use
thinking instead. Maximum tokens for thinking blocks.Literal['low', 'medium', 'high', 'max'] | None
default:"None"
Effort level for thinking depth.
dict[str, Any] | None
default:"None"
Output format for structured outputs (matches Messages API structure).
bool
default:"False"
Enable file checkpointing to track file changes. When enabled, files can be rewound to their state at any user message using
ClaudeSDKClient.rewind_files().Related Types
PermissionMode-"default" | "acceptEdits" | "plan" | "bypassPermissions"SdkBeta-"context-1m-2025-08-07"SettingSource-"user" | "project" | "local"ToolsPreset-{"type": "preset", "preset": "claude_code"}SystemPromptPreset-{"type": "preset", "preset": "claude_code", "append": "..."}