ClaudeAgentOptions
Configuration dataclass for customizing Claude Agent SDK behavior. Used with bothquery() and ClaudeSDKClient to control models, tools, permissions, hooks, and more.
Fields
List of tool names to enable, or a preset configuration.Example:
["Bash", "Read", "Write"] or {"type": "preset", "preset": "claude_code"}Additional tools to allow beyond the default set.
Tools to explicitly disallow.
Custom system prompt or preset configuration.Example:
"You are a helpful coding assistant" or {"type": "preset", "preset": "claude_code", "append": "Additional instructions"}MCP server configurations. Can be a dictionary of server configs, or a path to a config file.See MCP Types for configuration details.
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)
Claude model to use (e.g.,
"claude-sonnet-4-20250514", "claude-opus-4-20250514").Fallback model if the primary model is unavailable.
Beta features to enable. See Anthropic API beta headers.Available:
["context-1m-2025-08-07"]Maximum number of conversation turns before stopping.
Maximum budget in USD for the session.
Whether to continue an existing conversation session.
Session ID to resume from.
When true, resumed sessions will fork to a new session ID rather than continuing the previous session.
Working directory for the session.
Custom path to the Claude Code CLI executable.
Path to settings file.
Setting sources to load:
["user", "project", "local"]Additional directories to add to the workspace context.
Environment variables for the CLI process.
Arbitrary CLI flags to pass through.
Callback function for tool permission requests.
Hook configurations for lifecycle events.See Hook Types for details.
Custom agent definitions.
User identifier for the session.
Enable streaming of partial message updates via
StreamEvent messages.Maximum bytes when buffering CLI stdout.
Callback for stderr output from CLI.
Tool name to use for permission prompts.
Sandbox configuration for bash command isolation.
Plugin configurations.
Extended thinking configuration.
{"type": "adaptive"}- Adaptive thinking budget{"type": "enabled", "budget_tokens": 10000}- Fixed token budget{"type": "disabled"}- Disable extended thinking
Deprecated: Use
thinking instead. Maximum tokens for thinking blocks.Effort level for thinking depth.
Output format for structured outputs (matches Messages API structure).
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": "..."}