Class: ClaudeAgentSDK::ClaudeAgentOptions
- Inherits:
-
Object
- Object
- ClaudeAgentSDK::ClaudeAgentOptions
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Claude Agent Options for configuring queries
Constant Summary collapse
- OPTION_DEFAULTS =
Non-nil defaults for options that need them. Keys absent from here default to nil.
{ allowed_tools: [], disallowed_tools: [], add_dirs: [], mcp_servers: {}, env: {}, extra_args: {}, continue_conversation: false, include_partial_messages: false, fork_session: false, enable_file_checkpointing: false }.freeze
- VALID_OPTIONS =
Valid option names derived from attr_accessor declarations.
instance_methods.grep(/=\z/).map { |m| m.to_s.chomp('=').to_sym }.freeze
Instance Attribute Summary collapse
-
#add_dirs ⇒ Object
Returns the value of attribute add_dirs.
-
#agents ⇒ Object
Returns the value of attribute agents.
-
#allowed_tools ⇒ Object
Returns the value of attribute allowed_tools.
-
#append_allowed_tools ⇒ Object
Returns the value of attribute append_allowed_tools.
-
#betas ⇒ Object
Returns the value of attribute betas.
-
#can_use_tool ⇒ Object
Returns the value of attribute can_use_tool.
-
#cli_path ⇒ Object
Returns the value of attribute cli_path.
-
#continue_conversation ⇒ Object
Returns the value of attribute continue_conversation.
-
#cwd ⇒ Object
Returns the value of attribute cwd.
-
#debug_stderr ⇒ Object
Returns the value of attribute debug_stderr.
-
#disallowed_tools ⇒ Object
Returns the value of attribute disallowed_tools.
-
#effort ⇒ Object
Returns the value of attribute effort.
-
#enable_file_checkpointing ⇒ Object
Returns the value of attribute enable_file_checkpointing.
-
#env ⇒ Object
Returns the value of attribute env.
-
#extra_args ⇒ Object
Returns the value of attribute extra_args.
-
#fallback_model ⇒ Object
Returns the value of attribute fallback_model.
-
#fork_session ⇒ Object
Returns the value of attribute fork_session.
-
#hooks ⇒ Object
Returns the value of attribute hooks.
-
#include_partial_messages ⇒ Object
Returns the value of attribute include_partial_messages.
-
#max_budget_usd ⇒ Object
Returns the value of attribute max_budget_usd.
-
#max_buffer_size ⇒ Object
Returns the value of attribute max_buffer_size.
-
#max_thinking_tokens ⇒ Object
Returns the value of attribute max_thinking_tokens.
-
#max_turns ⇒ Object
Returns the value of attribute max_turns.
-
#mcp_servers ⇒ Object
Returns the value of attribute mcp_servers.
-
#model ⇒ Object
Returns the value of attribute model.
-
#output_format ⇒ Object
Returns the value of attribute output_format.
-
#permission_mode ⇒ Object
Returns the value of attribute permission_mode.
-
#permission_prompt_tool_name ⇒ Object
Returns the value of attribute permission_prompt_tool_name.
-
#plugins ⇒ Object
Returns the value of attribute plugins.
-
#resume ⇒ Object
Returns the value of attribute resume.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#setting_sources ⇒ Object
Returns the value of attribute setting_sources.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#system_prompt ⇒ Object
Returns the value of attribute system_prompt.
-
#thinking ⇒ Object
Returns the value of attribute thinking.
-
#tools ⇒ Object
Returns the value of attribute tools.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #dup_with(**changes) ⇒ Object
-
#initialize(**kwargs) ⇒ ClaudeAgentOptions
constructor
Using **kwargs lets us distinguish “caller passed allowed_tools: []” from “caller omitted allowed_tools” — critical for correct merge with configured defaults.
Constructor Details
#initialize(**kwargs) ⇒ ClaudeAgentOptions
Using **kwargs lets us distinguish “caller passed allowed_tools: []” from “caller omitted allowed_tools” — critical for correct merge with configured defaults.
850 851 852 853 854 855 856 857 858 |
# File 'lib/claude_agent_sdk/types.rb', line 850 def initialize(**kwargs) unknown = kwargs.keys - VALID_OPTIONS raise ArgumentError, "unknown keyword#{'s' if unknown.size > 1}: #{unknown.join(', ')}" if unknown.any? merged = merge_with_defaults(kwargs) OPTION_DEFAULTS.merge(merged).each do |key, value| instance_variable_set(:"@#{key}", value) end end |
Instance Attribute Details
#add_dirs ⇒ Object
Returns the value of attribute add_dirs.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def add_dirs @add_dirs end |
#agents ⇒ Object
Returns the value of attribute agents.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def agents @agents end |
#allowed_tools ⇒ Object
Returns the value of attribute allowed_tools.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def allowed_tools @allowed_tools end |
#append_allowed_tools ⇒ Object
Returns the value of attribute append_allowed_tools.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def append_allowed_tools @append_allowed_tools end |
#betas ⇒ Object
Returns the value of attribute betas.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def betas @betas end |
#can_use_tool ⇒ Object
Returns the value of attribute can_use_tool.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def can_use_tool @can_use_tool end |
#cli_path ⇒ Object
Returns the value of attribute cli_path.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def cli_path @cli_path end |
#continue_conversation ⇒ Object
Returns the value of attribute continue_conversation.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def continue_conversation @continue_conversation end |
#cwd ⇒ Object
Returns the value of attribute cwd.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def cwd @cwd end |
#debug_stderr ⇒ Object
Returns the value of attribute debug_stderr.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def debug_stderr @debug_stderr end |
#disallowed_tools ⇒ Object
Returns the value of attribute disallowed_tools.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def disallowed_tools @disallowed_tools end |
#effort ⇒ Object
Returns the value of attribute effort.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def effort @effort end |
#enable_file_checkpointing ⇒ Object
Returns the value of attribute enable_file_checkpointing.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def enable_file_checkpointing @enable_file_checkpointing end |
#env ⇒ Object
Returns the value of attribute env.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def env @env end |
#extra_args ⇒ Object
Returns the value of attribute extra_args.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def extra_args @extra_args end |
#fallback_model ⇒ Object
Returns the value of attribute fallback_model.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def fallback_model @fallback_model end |
#fork_session ⇒ Object
Returns the value of attribute fork_session.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def fork_session @fork_session end |
#hooks ⇒ Object
Returns the value of attribute hooks.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def hooks @hooks end |
#include_partial_messages ⇒ Object
Returns the value of attribute include_partial_messages.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def @include_partial_messages end |
#max_budget_usd ⇒ Object
Returns the value of attribute max_budget_usd.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def max_budget_usd @max_budget_usd end |
#max_buffer_size ⇒ Object
Returns the value of attribute max_buffer_size.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def max_buffer_size @max_buffer_size end |
#max_thinking_tokens ⇒ Object
Returns the value of attribute max_thinking_tokens.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def max_thinking_tokens @max_thinking_tokens end |
#max_turns ⇒ Object
Returns the value of attribute max_turns.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def max_turns @max_turns end |
#mcp_servers ⇒ Object
Returns the value of attribute mcp_servers.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def mcp_servers @mcp_servers end |
#model ⇒ Object
Returns the value of attribute model.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def model @model end |
#output_format ⇒ Object
Returns the value of attribute output_format.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def output_format @output_format end |
#permission_mode ⇒ Object
Returns the value of attribute permission_mode.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def @permission_mode end |
#permission_prompt_tool_name ⇒ Object
Returns the value of attribute permission_prompt_tool_name.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def @permission_prompt_tool_name end |
#plugins ⇒ Object
Returns the value of attribute plugins.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def plugins @plugins end |
#resume ⇒ Object
Returns the value of attribute resume.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def resume @resume end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def sandbox @sandbox end |
#setting_sources ⇒ Object
Returns the value of attribute setting_sources.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def setting_sources @setting_sources end |
#settings ⇒ Object
Returns the value of attribute settings.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def settings @settings end |
#stderr ⇒ Object
Returns the value of attribute stderr.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def stderr @stderr end |
#system_prompt ⇒ Object
Returns the value of attribute system_prompt.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def system_prompt @system_prompt end |
#thinking ⇒ Object
Returns the value of attribute thinking.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def thinking @thinking end |
#tools ⇒ Object
Returns the value of attribute tools.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def tools @tools end |
#user ⇒ Object
Returns the value of attribute user.
824 825 826 |
# File 'lib/claude_agent_sdk/types.rb', line 824 def user @user end |
Instance Method Details
#dup_with(**changes) ⇒ Object
860 861 862 863 864 |
# File 'lib/claude_agent_sdk/types.rb', line 860 def dup_with(**changes) = self.dup changes.each { |key, value| .send(:"#{key}=", value) } end |