Class: BashTool
- Inherits:
-
LlmGateway::Tool
- Object
- LlmGateway::Tool
- BashTool
- Defined in:
- lib/llm_gateway/agents/tools/bash_tool.rb
Instance Method Summary collapse
Methods inherited from LlmGateway::Tool
cache, definition, description, #initialize, input_schema, name, tool_name
Constructor Details
This class inherits a constructor from LlmGateway::Tool
Instance Method Details
#execute(input) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/llm_gateway/agents/tools/bash_tool.rb', line 20 def execute(input) command = input[:command] timeout = input[:timeout] result = run_command(command, timeout) out = format_output(result[:output], empty_text: result[:timed_out] ? "" : "(no output)") if result[:timed_out] return append_status(out, "Command timed out after #{timeout} seconds") end if result[:exit_status] && result[:exit_status] != 0 return append_status(out, "Command exited with code #{result[:exit_status]}") end out rescue StandardError => e e. end |