Class: Anthropic::Models::CodeExecutionTool20260120

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/code_execution_tool_20260120.rb,
sig/anthropic/models/code_execution_tool_20260120.rbs

Defined Under Namespace

Modules: AllowedCaller

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(allowed_callers: nil, cache_control: nil, defer_loading: nil, strict: nil, name: :code_execution, type: :code_execution_20260120) ⇒ CodeExecutionTool20260120

A tools entry for the code execution tool, version code_execution_20260120. It adds REPL state persistence to version code_execution_20250825.

REPL state persistence applies with programmatic tool calling. With it, the Python interpreter state, such as variable bindings, persists across requests that reuse the container.

See the code execution tool guide to learn what each tool version adds.

Some parameter documentations has been truncated, see Anthropic::Models::CodeExecutionTool20260120 for more details.

Parameters:

  • allowed_callers (Array<Symbol, Anthropic::Models::CodeExecutionTool20260120::AllowedCaller>) (defaults to: nil)
  • cache_control (Anthropic::Models::CacheControlEphemeral, nil) (defaults to: nil) —

    Create a cache control breakpoint at this content block.

  • defer_loading (Boolean) (defaults to: nil) —

    If true, tool will not be included in initial system prompt. Only loaded when re

  • strict (Boolean) (defaults to: nil) —

    When true, guarantees schema validation on tool names and inputs

  • name (Symbol, :code_execution) (defaults to: :code_execution) —

    Name of the tool.

  • type (Symbol, :code_execution_20260120) (defaults to: :code_execution_20260120)
  • allowed_callers: (::Array[Anthropic::Models::CodeExecutionTool20260120::allowed_caller]) (defaults to: nil)
  • cache_control: (Anthropic::CacheControlEphemeral, nil) (defaults to: nil)
  • defer_loading: (Boolean) (defaults to: nil)
  • strict: (Boolean) (defaults to: nil)
  • name: (:code_execution) (defaults to: :code_execution)
  • type: (:code_execution_20260120) (defaults to: :code_execution_20260120)


# File 'lib/anthropic/models/code_execution_tool_20260120.rb', line 44

Instance Attribute Details

#allowed_callers ⇒ Array<Symbol, Anthropic::Models::CodeExecutionTool20260120::AllowedCaller>?

Parameters:

  • (::Array[Anthropic::Models::CodeExecutionTool20260120::allowed_caller])

Returns:



22
23
# File 'lib/anthropic/models/code_execution_tool_20260120.rb', line 22

optional :allowed_callers,
-> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::CodeExecutionTool20260120::AllowedCaller] }

#cache_control ⇒ Anthropic::Models::CacheControlEphemeral?

Create a cache control breakpoint at this content block.



29
# File 'lib/anthropic/models/code_execution_tool_20260120.rb', line 29

optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true

#defer_loading ⇒ Boolean?

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

Parameters:

Returns:



36
# File 'lib/anthropic/models/code_execution_tool_20260120.rb', line 36

optional :defer_loading, Anthropic::Internal::Type::Boolean

#name ⇒ Symbol, :code_execution

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

Parameters:

  • value (:code_execution)

Returns:

  • (Symbol, :code_execution)


12
# File 'lib/anthropic/models/code_execution_tool_20260120.rb', line 12

required :name, const: :code_execution

#strict ⇒ Boolean?

When true, guarantees schema validation on tool names and inputs

Parameters:

Returns:



42
# File 'lib/anthropic/models/code_execution_tool_20260120.rb', line 42

optional :strict, Anthropic::Internal::Type::Boolean

#type ⇒ Symbol, :code_execution_20260120

Parameters:

  • value (:code_execution_20260120)

Returns:

  • (Symbol, :code_execution_20260120)


17
# File 'lib/anthropic/models/code_execution_tool_20260120.rb', line 17

required :type, const: :code_execution_20260120

Instance Method Details

#to_hash ⇒ { name: :code_execution, type: :code_execution_20260120, allowed_callers: ::Array[Anthropic::Models::CodeExecutionTool20260120::allowed_caller], cache_control: Anthropic::CacheControlEphemeral?, defer_loading: bool, strict: bool }

Returns:

  • ({ name: :code_execution, type: :code_execution_20260120, allowed_callers: ::Array[Anthropic::Models::CodeExecutionTool20260120::allowed_caller], cache_control: Anthropic::CacheControlEphemeral?, defer_loading: bool, strict: bool })


43
44
45
46
47
48
49
50
# File 'sig/anthropic/models/code_execution_tool_20260120.rbs', line 43

def to_hash: -> {
  name: :code_execution,
  type: :code_execution_20260120,
  allowed_callers: ::Array[Anthropic::Models::CodeExecutionTool20260120::allowed_caller],
  cache_control: Anthropic::CacheControlEphemeral?,
  defer_loading: bool,
  strict: bool
}