Class: OllamaAgent::ToolRuntime::Supervisor
- Inherits:
-
Object
- Object
- OllamaAgent::ToolRuntime::Supervisor
- Defined in:
- lib/ollama_agent/tool_runtime/supervisor.rb
Overview
Planner output + phase-scoped tool execution with escalation hooks.
Constant Summary collapse
- PLANNER_FAILURES =
%i[invalid_after_retries budget_exceeded].freeze
Instance Method Summary collapse
-
#initialize(planner:, tool_registry:, escalation_callback: nil, max_local_attempts: 3) ⇒ Supervisor
constructor
A new instance of Supervisor.
-
#orchestrate(prompt:, context:, phase:) ⇒ Hash
:result,:escalated.
Constructor Details
#initialize(planner:, tool_registry:, escalation_callback: nil, max_local_attempts: 3) ⇒ Supervisor
Returns a new instance of Supervisor.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ollama_agent/tool_runtime/supervisor.rb', line 9 def initialize( planner:, tool_registry:, escalation_callback: nil, max_local_attempts: 3 ) @planner = planner @tool_registry = tool_registry @escalation_callback = escalation_callback || proc { :escalated_stub } @max_local_attempts = Integer(max_local_attempts) end |
Instance Method Details
#orchestrate(prompt:, context:, phase:) ⇒ Hash
Returns :result, :escalated.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ollama_agent/tool_runtime/supervisor.rb', line 22 def orchestrate(prompt:, context:, phase:) state = build_initial_orchestration_state @max_local_attempts.times do outcome = run_orchestration_attempt!(state, prompt, context, phase) return escalate! if outcome == :escalate break if outcome end finalize_orchestration(state) end |