Class: RubyLLM::Toolbox::Tools::RunRuby
- Includes:
- SandboxRun
- Defined in:
- lib/ruby_llm/toolbox/tools/run_ruby.rb
Overview
EXEC. Executes a Ruby snippet inside a hardened Docker container (no network, read-only filesystem, dropped capabilities, memory/CPU/pids limits, wall-clock timeout). Source is piped to the interpreter on stdin, so nothing from the host is mounted.
Gated: requires config.enable_exec_tools AND Docker on the host.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from SandboxRun
#format_sandbox, #run_in_sandbox
Methods inherited from Base
#call, exec_tool!, exec_tool?, #initialize, #name
Constructor Details
This class inherits a constructor from RubyLLM::Toolbox::Base
Instance Method Details
#execute(code:) ⇒ Object
29 30 31 32 33 |
# File 'lib/ruby_llm/toolbox/tools/run_ruby.rb', line 29 def execute(code:) return error("code must be provided", code: :empty_code) if code.to_s.strip.empty? run_in_sandbox(["ruby"], code, image: config.docker_image) end |