Class: RobotLab::To::Tools::RequestDecision
- Inherits:
-
RobotLab::Tool
- Object
- RobotLab::Tool
- RobotLab::To::Tools::RequestDecision
- Defined in:
- lib/robot_lab/to/tools/request_decision.rb
Overview
Tool the robot calls to escalate a choice it should NOT make on its own.
Instead of blocking on a human (impossible in an unattended loop), the robot records the decision as an artifact — situation, options, and its recommended lean — and keeps going or stops. The orchestrator persists each captured request as a decision file; a human resolves it out-of-band.
Create a fresh instance per iteration. After robot.run() returns, read captured_requests (empty if the robot raised none).
Instance Method Summary collapse
- #captured_requests ⇒ Object
- #execute(question:, situation: "", options: [], recommendation: "", blocking: false) ⇒ Object
Instance Method Details
#captured_requests ⇒ Object
43 44 45 |
# File 'lib/robot_lab/to/tools/request_decision.rb', line 43 def captured_requests @captured_requests ||= [] end |
#execute(question:, situation: "", options: [], recommendation: "", blocking: false) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/robot_lab/to/tools/request_decision.rb', line 47 def execute(question:, situation: "", options: [], recommendation: "", blocking: false, **) (@captured_requests ||= []) << { question: question, situation: situation.to_s, options: Array(), recommendation: recommendation.to_s, blocking: blocking ? true : false } if blocking "Decision recorded (BLOCKING). Stop work now and call submit_iteration_result; " \ "the run will pause until a human resolves it." else "Decision recorded. Continue with other work you can safely do, then submit your result." end end |