Class: ClaudeAgentSDK::ClaudeAgentOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_agent_sdk/types.rb

Overview

Claude Agent Options for configuring queries

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allowed_tools: [], system_prompt: nil, mcp_servers: {}, permission_mode: nil, continue_conversation: false, resume: nil, max_turns: nil, disallowed_tools: [], model: nil, permission_prompt_tool_name: nil, cwd: nil, cli_path: nil, settings: nil, add_dirs: [], env: {}, extra_args: {}, max_buffer_size: nil, stderr: nil, can_use_tool: nil, hooks: nil, user: nil, include_partial_messages: false, fork_session: false, agents: nil, setting_sources: nil, output_format: nil, max_budget_usd: nil, max_thinking_tokens: nil, fallback_model: nil, plugins: nil, debug_stderr: nil, betas: nil, tools: nil, sandbox: nil, enable_file_checkpointing: false, append_allowed_tools: nil) ⇒ ClaudeAgentOptions

Returns a new instance of ClaudeAgentOptions.



787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/claude_agent_sdk/types.rb', line 787

def initialize(
  allowed_tools: [],
  system_prompt: nil,
  mcp_servers: {},
  permission_mode: nil,
  continue_conversation: false,
  resume: nil,
  max_turns: nil,
  disallowed_tools: [],
  model: nil,
  permission_prompt_tool_name: nil,
  cwd: nil,
  cli_path: nil,
  settings: nil,
  add_dirs: [],
  env: {},
  extra_args: {},
  max_buffer_size: nil,
  stderr: nil,
  can_use_tool: nil,
  hooks: nil,
  user: nil,
  include_partial_messages: false,
  fork_session: false,
  agents: nil,
  setting_sources: nil,
  output_format: nil,
  max_budget_usd: nil,
  max_thinking_tokens: nil,
  fallback_model: nil,
  plugins: nil,
  debug_stderr: nil,
  betas: nil,
  tools: nil,
  sandbox: nil,
  enable_file_checkpointing: false,
  append_allowed_tools: nil
)
  @allowed_tools = allowed_tools
  @system_prompt = system_prompt
  @mcp_servers = mcp_servers
  @permission_mode = permission_mode
  @continue_conversation = continue_conversation
  @resume = resume
  @max_turns = max_turns
  @disallowed_tools = disallowed_tools
  @model = model
  @permission_prompt_tool_name = permission_prompt_tool_name
  @cwd = cwd
  @cli_path = cli_path
  @settings = settings
  @add_dirs = add_dirs
  @env = env
  @extra_args = extra_args
  @max_buffer_size = max_buffer_size
  @stderr = stderr
  @can_use_tool = can_use_tool
  @hooks = hooks
  @user = user
  @include_partial_messages = include_partial_messages
  @fork_session = fork_session
  @agents = agents
  @setting_sources = setting_sources
  @output_format = output_format # JSON schema for structured output
  @max_budget_usd = max_budget_usd # Spending cap in dollars
  @max_thinking_tokens = max_thinking_tokens # Extended thinking token budget
  @fallback_model = fallback_model # Backup model if primary unavailable
  @plugins = plugins # Array of SdkPluginConfig
  @debug_stderr = debug_stderr # Debug output file object/path
  @betas = betas # Array of beta feature strings (e.g., ["context-1m-2025-08-07"])
  @tools = tools # Base tools selection: Array, empty array [], or ToolsPreset
  @sandbox = sandbox # SandboxSettings instance for isolated command execution
  @enable_file_checkpointing = enable_file_checkpointing # Enable file checkpointing for rewind support
  @append_allowed_tools = append_allowed_tools # Array of tools to append to allowed_tools
end

Instance Attribute Details

#add_dirsObject

Returns the value of attribute add_dirs.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def add_dirs
  @add_dirs
end

#agentsObject

Returns the value of attribute agents.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def agents
  @agents
end

#allowed_toolsObject

Returns the value of attribute allowed_tools.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def allowed_tools
  @allowed_tools
end

#append_allowed_toolsObject

Returns the value of attribute append_allowed_tools.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def append_allowed_tools
  @append_allowed_tools
end

#betasObject

Returns the value of attribute betas.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def betas
  @betas
end

#can_use_toolObject

Returns the value of attribute can_use_tool.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def can_use_tool
  @can_use_tool
end

#cli_pathObject

Returns the value of attribute cli_path.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def cli_path
  @cli_path
end

#continue_conversationObject

Returns the value of attribute continue_conversation.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def continue_conversation
  @continue_conversation
end

#cwdObject

Returns the value of attribute cwd.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def cwd
  @cwd
end

#debug_stderrObject

Returns the value of attribute debug_stderr.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def debug_stderr
  @debug_stderr
end

#disallowed_toolsObject

Returns the value of attribute disallowed_tools.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def disallowed_tools
  @disallowed_tools
end

#enable_file_checkpointingObject

Returns the value of attribute enable_file_checkpointing.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def enable_file_checkpointing
  @enable_file_checkpointing
end

#envObject

Returns the value of attribute env.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def env
  @env
end

#extra_argsObject

Returns the value of attribute extra_args.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def extra_args
  @extra_args
end

#fallback_modelObject

Returns the value of attribute fallback_model.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def fallback_model
  @fallback_model
end

#fork_sessionObject

Returns the value of attribute fork_session.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def fork_session
  @fork_session
end

#hooksObject

Returns the value of attribute hooks.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def hooks
  @hooks
end

#include_partial_messagesObject

Returns the value of attribute include_partial_messages.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def include_partial_messages
  @include_partial_messages
end

#max_budget_usdObject

Returns the value of attribute max_budget_usd.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def max_budget_usd
  @max_budget_usd
end

#max_buffer_sizeObject

Returns the value of attribute max_buffer_size.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def max_buffer_size
  @max_buffer_size
end

#max_thinking_tokensObject

Returns the value of attribute max_thinking_tokens.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def max_thinking_tokens
  @max_thinking_tokens
end

#max_turnsObject

Returns the value of attribute max_turns.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def max_turns
  @max_turns
end

#mcp_serversObject

Returns the value of attribute mcp_servers.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def mcp_servers
  @mcp_servers
end

#modelObject

Returns the value of attribute model.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def model
  @model
end

#output_formatObject

Returns the value of attribute output_format.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def output_format
  @output_format
end

#permission_modeObject

Returns the value of attribute permission_mode.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def permission_mode
  @permission_mode
end

#permission_prompt_tool_nameObject

Returns the value of attribute permission_prompt_tool_name.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def permission_prompt_tool_name
  @permission_prompt_tool_name
end

#pluginsObject

Returns the value of attribute plugins.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def plugins
  @plugins
end

#resumeObject

Returns the value of attribute resume.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def resume
  @resume
end

#sandboxObject

Returns the value of attribute sandbox.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def sandbox
  @sandbox
end

#setting_sourcesObject

Returns the value of attribute setting_sources.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def setting_sources
  @setting_sources
end

#settingsObject

Returns the value of attribute settings.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def settings
  @settings
end

#stderrObject

Returns the value of attribute stderr.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def stderr
  @stderr
end

#system_promptObject

Returns the value of attribute system_prompt.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def system_prompt
  @system_prompt
end

#toolsObject

Returns the value of attribute tools.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def tools
  @tools
end

#userObject

Returns the value of attribute user.



777
778
779
# File 'lib/claude_agent_sdk/types.rb', line 777

def user
  @user
end

Instance Method Details

#dup_with(**changes) ⇒ Object



863
864
865
866
867
# File 'lib/claude_agent_sdk/types.rb', line 863

def dup_with(**changes)
  new_options = self.dup
  changes.each { |key, value| new_options.send("#{key}=", value) }
  new_options
end