Class: Agents::Tool
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Agents::Tool
- Defined in:
- lib/agents/tool.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#execute(tool_context, **params) ⇒ String
Execute the tool with context injection.
-
#perform(tool_context, **params) ⇒ String
Perform the tool’s action.
Instance Method Details
#execute(tool_context, **params) ⇒ String
Execute the tool with context injection. This method is called by the runner and handles the thread-safe execution pattern by passing all state through parameters.
48 49 50 |
# File 'lib/agents/tool.rb', line 48 def execute(tool_context, **params) perform(tool_context, **params) end |
#perform(tool_context, **params) ⇒ String
Perform the tool’s action. Subclasses must implement this method. This is where the actual tool logic lives. The method receives all execution state through parameters, ensuring thread safety.
68 69 70 |
# File 'lib/agents/tool.rb', line 68 def perform(tool_context, **params) raise NotImplementedError, "Tools must implement #perform(tool_context, **params)" end |