class Riffer::Tools::Runtime
Public Class Methods
Source
# File lib/riffer/tools/runtime.rb, line 11 def initialize(runner:) if instance_of?(Riffer::Tools::Runtime) raise NotImplementedError, "#{self.class} is abstract — use a subclass like Riffer::Tools::Runtime::Inline" end @runner = runner end
Public Instance Methods
Source
# File lib/riffer/tools/runtime.rb, line 41 def around_tool_call(_tool_call, context:, assistant_message: nil) yield end
Overrides must yield and return its Response.
Source
# File lib/riffer/tools/runtime.rb, line 22 def execute(tool_calls, tools:, context:, assistant_message: nil, tags: {}) # Each Runner worker runs in its own thread/fiber, where the OTEL context # starts empty — capture here so the execute_tool span parents correctly. trace_context = Riffer::Tracing.current_context @runner.map(tool_calls, context: context) do |tool_call| Riffer::Tracing.with_context(trace_context) do # Outside around_tool_call so host enrichment spans nest beneath it. instrument_tool_call(tool_call, tags) do around_tool_call(tool_call, context: context, assistant_message: assistant_message) do dispatch_tool_call(tool_call, tools: tools, context: context, assistant_message: assistant_message) end end end end end