Class: Collavre::AiAgent::ApprovalHandler
- Inherits:
-
Object
- Object
- Collavre::AiAgent::ApprovalHandler
- Defined in:
- app/services/collavre/ai_agent/approval_handler.rb
Overview
Handles tool-execution approval flow when an AI agent invokes a tool that requires human approval.
Instance Method Summary collapse
- #handle(error, summary: nil) ⇒ Object
-
#initialize(task:, agent:, context:, creative: nil, reply_comment: nil) ⇒ ApprovalHandler
constructor
A new instance of ApprovalHandler.
Constructor Details
#initialize(task:, agent:, context:, creative: nil, reply_comment: nil) ⇒ ApprovalHandler
Returns a new instance of ApprovalHandler.
8 9 10 11 12 13 14 |
# File 'app/services/collavre/ai_agent/approval_handler.rb', line 8 def initialize(task:, agent:, context:, creative: nil, reply_comment: nil) @task = task @agent = agent @context = context @creative = creative @reply_comment = reply_comment end |
Instance Method Details
#handle(error, summary: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/collavre/ai_agent/approval_handler.rb', line 16 def handle(error, summary: nil) cleanup_placeholder broadcast_idle update_task(error) log_action(error) create_approval_comment(error, summary: summary) end |