Module: Legion::Extensions::Agentic::Executive::DualProcess::Runners::DualProcess
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb
Instance Method Summary collapse
- #best_heuristics(limit: 5) ⇒ Object
- #dual_process_stats ⇒ Object
- #effort_assessment ⇒ Object
- #execute_system_one(query:, domain:) ⇒ Object
- #execute_system_two(query:, domain:, deliberation: {}) ⇒ Object
- #record_decision_outcome(decision_id:, outcome:) ⇒ Object
- #register_heuristic(pattern:, domain:, response:, confidence: nil) ⇒ Object
- #route_decision(query:, domain:, complexity:) ⇒ Object
- #system_usage_stats ⇒ Object
- #update_dual_process ⇒ Object
Instance Method Details
#best_heuristics(limit: 5) ⇒ Object
54 55 56 57 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 54 def best_heuristics(limit: 5, **) Legion::Logging.debug "[dual_process] best_heuristics limit=#{limit}" { success: true, heuristics: engine.best_heuristics(limit: limit) } end |
#dual_process_stats ⇒ Object
71 72 73 74 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 71 def dual_process_stats(**) Legion::Logging.debug '[dual_process] dual_process_stats' { success: true, **engine.to_h } end |
#effort_assessment ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 44 def effort_assessment(**) Legion::Logging.debug '[dual_process] effort_assessment' { success: true, effort_level: engine.effort_level, effort_budget: engine.instance_variable_get(:@effort_budget), routing_label: engine.routing_label } end |
#execute_system_one(query:, domain:) ⇒ Object
27 28 29 30 31 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 27 def execute_system_one(query:, domain:, **) Legion::Logging.debug "[dual_process] execute_system_one domain=#{domain}" result = engine.execute_system_one(query: query, domain: domain) { success: true, **result } end |
#execute_system_two(query:, domain:, deliberation: {}) ⇒ Object
33 34 35 36 37 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 33 def execute_system_two(query:, domain:, deliberation: {}, **) Legion::Logging.debug "[dual_process] execute_system_two domain=#{domain}" result = engine.execute_system_two(query: query, domain: domain, deliberation: deliberation) { success: true, **result } end |
#record_decision_outcome(decision_id:, outcome:) ⇒ Object
39 40 41 42 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 39 def record_decision_outcome(decision_id:, outcome:, **) Legion::Logging.debug "[dual_process] record_outcome decision_id=#{decision_id} outcome=#{outcome}" engine.record_outcome(decision_id: decision_id, outcome: outcome) end |
#register_heuristic(pattern:, domain:, response:, confidence: nil) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 13 def register_heuristic(pattern:, domain:, response:, confidence: nil, **) Legion::Logging.debug "[dual_process] register_heuristic pattern=#{pattern} domain=#{domain}" opts = { pattern: pattern, domain: domain, response: response } opts[:confidence] = confidence unless confidence.nil? heuristic = engine.register_heuristic(**opts) { success: true, heuristic: heuristic.to_h } end |
#route_decision(query:, domain:, complexity:) ⇒ Object
21 22 23 24 25 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 21 def route_decision(query:, domain:, complexity:, **) Legion::Logging.debug "[dual_process] route_decision domain=#{domain} complexity=#{complexity}" route = engine.route_decision(query: query, domain: domain, complexity: complexity) { success: true, **route } end |
#system_usage_stats ⇒ Object
59 60 61 62 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 59 def system_usage_stats(**) Legion::Logging.debug '[dual_process] system_usage_stats' { success: true, stats: engine.system_stats } end |
#update_dual_process ⇒ Object
64 65 66 67 68 69 |
# File 'lib/legion/extensions/agentic/executive/dual_process/runners/dual_process.rb', line 64 def update_dual_process(**) Legion::Logging.debug '[dual_process] update_dual_process' engine.recover_effort engine.decay_heuristics { success: true, effort_level: engine.effort_level, routing_label: engine.routing_label } end |