Class: AgentRuntime::ToolRegistry
- Inherits:
-
Object
- Object
- AgentRuntime::ToolRegistry
- Defined in:
- lib/agent_runtime/tool_registry.rb
Overview
Registry mapping tool names to Ruby callables.
This class maintains a registry of available tools that can be called by the executor. Tools are registered as callable objects (procs, lambdas, or objects responding to #call).
Instance Method Summary collapse
-
#call(action, params) ⇒ Object
Call a tool by name with the given parameters.
-
#initialize(tools = {}) ⇒ ToolRegistry
constructor
Initialize a new ToolRegistry instance.
Constructor Details
#initialize(tools = {}) ⇒ ToolRegistry
Initialize a new ToolRegistry instance.
29 30 31 |
# File 'lib/agent_runtime/tool_registry.rb', line 29 def initialize(tools = {}) @tools = tools end |
Instance Method Details
#call(action, params) ⇒ Object
Call a tool by name with the given parameters.
43 44 45 46 47 48 |
# File 'lib/agent_runtime/tool_registry.rb', line 43 def call(action, params) tool = @tools[action] raise ToolNotFound, "Tool not found: #{action}" unless tool tool.call(**params) end |