Class: Phronomy::Agent::ApprovalEvaluationRequest
- Inherits:
-
Object
- Object
- Phronomy::Agent::ApprovalEvaluationRequest
- Defined in:
- lib/phronomy/agent/approval_evaluation_request.rb
Overview
Immutable input passed to Tool approval policy callables.
This object intentionally contains the internal, validated arguments used for policy evaluation. It must not be exposed directly to Application UI. Use ToolApprovalRequest for notifications.
Constant Summary collapse
- VALID_DECISIONS =
%i[allow require_approval reject].freeze
Instance Attribute Summary collapse
- #agent ⇒ Object readonly
- #agent_invocation_id ⇒ Object readonly
- #arguments ⇒ Object readonly
- #default_decision ⇒ Object readonly
- #facts ⇒ Object readonly
- #invocation_context ⇒ Object readonly
- #metadata ⇒ Object readonly
- #origin ⇒ Object readonly
- #tool ⇒ Object readonly
- #tool_call_id ⇒ Object readonly
- #tool_invocation_id ⇒ Object readonly
- #tool_name ⇒ Object readonly
- #tool_schema ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(agent:, agent_invocation_id:, tool:, tool_name:, tool_schema:, tool_invocation_id:, tool_call_id:, arguments:, facts: {}, invocation_context: {}, origin: :local, metadata: {}, default_decision: nil) ⇒ ApprovalEvaluationRequest
constructor
A new instance of ApprovalEvaluationRequest.
-
#with(facts: @facts, default_decision: @default_decision) ⇒ Object
private
Returns a new request with selected fields replaced.
Constructor Details
#initialize(agent:, agent_invocation_id:, tool:, tool_name:, tool_schema:, tool_invocation_id:, tool_call_id:, arguments:, facts: {}, invocation_context: {}, origin: :local, metadata: {}, default_decision: nil) ⇒ ApprovalEvaluationRequest
Returns a new instance of ApprovalEvaluationRequest.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 29 def initialize( agent:, agent_invocation_id:, tool:, tool_name:, tool_schema:, tool_invocation_id:, tool_call_id:, arguments:, facts: {}, invocation_context: {}, origin: :local, metadata: {}, default_decision: nil ) @agent = agent @agent_invocation_id = agent_invocation_id @tool = tool @tool_name = tool_name.to_s.freeze @tool_schema = immutable_copy(tool_schema) @tool_invocation_id = tool_invocation_id.to_s.freeze @tool_call_id = tool_call_id&.to_s&.freeze @arguments = immutable_copy(arguments) @facts = immutable_copy(facts || {}) @invocation_context = immutable_copy(invocation_context || {}) @origin = origin.to_sym @metadata = immutable_copy( || {}) @default_decision = default_decision&.to_sym freeze end |
Instance Attribute Details
#agent ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def agent @agent end |
#agent_invocation_id ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def agent_invocation_id @agent_invocation_id end |
#arguments ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def arguments @arguments end |
#default_decision ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def default_decision @default_decision end |
#facts ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def facts @facts end |
#invocation_context ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def invocation_context @invocation_context end |
#metadata ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def @metadata end |
#origin ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def origin @origin end |
#tool ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def tool @tool end |
#tool_call_id ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def tool_call_id @tool_call_id end |
#tool_invocation_id ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def tool_invocation_id @tool_invocation_id end |
#tool_name ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def tool_name @tool_name end |
#tool_schema ⇒ Object (readonly)
13 14 15 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 13 def tool_schema @tool_schema end |
Instance Method Details
#with(facts: @facts, default_decision: @default_decision) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new request with selected fields replaced.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/phronomy/agent/approval_evaluation_request.rb', line 62 def with(facts: @facts, default_decision: @default_decision) self.class.new( agent: @agent, agent_invocation_id: @agent_invocation_id, tool: @tool, tool_name: @tool_name, tool_schema: @tool_schema, tool_invocation_id: @tool_invocation_id, tool_call_id: @tool_call_id, arguments: @arguments, facts: facts, invocation_context: @invocation_context, origin: @origin, metadata: @metadata, default_decision: default_decision ) end |