Class: AgUiProtocol::Core::Events::RunFinishedEvent
- Inherits:
-
BaseEvent
- Object
- Types::Model
- BaseEvent
- AgUiProtocol::Core::Events::RunFinishedEvent
- Defined in:
- lib/ag_ui_protocol/core/events.rb
Overview
Signals the completion of an agent run. The ‘outcome` field discriminates between success and interrupt: provide either a `RunFinishedSuccessOutcome` or `RunFinishedInterruptOutcome` (or use the legacy `result` field; the two are mutually exclusive).
“‘ruby
event = AgUiProtocol::Core::Events::RunFinishedEvent.new(thread_id: “t1”, run_id: “r1”, result: { “a” => 1 })
“‘
Instance Attribute Summary collapse
-
#outcome ⇒ Object
readonly
Returns the value of attribute outcome.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#run_id ⇒ Object
readonly
Returns the value of attribute run_id.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
Attributes inherited from BaseEvent
Instance Method Summary collapse
-
#initialize(thread_id:, run_id:, result: nil, outcome: nil, timestamp: nil, raw_event: nil) ⇒ RunFinishedEvent
constructor
A new instance of RunFinishedEvent.
- #to_h ⇒ Object
Methods inherited from Types::Model
Constructor Details
#initialize(thread_id:, run_id:, result: nil, outcome: nil, timestamp: nil, raw_event: nil) ⇒ RunFinishedEvent
Returns a new instance of RunFinishedEvent.
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/ag_ui_protocol/core/events.rb', line 1034 def initialize(thread_id:, run_id:, result: nil, outcome: nil, timestamp: nil, raw_event: nil) if !result.nil? && !outcome.nil? raise ArgumentError, "result and outcome are mutually exclusive; provide one or the other, not both" end super(type: EventType::RUN_FINISHED, timestamp: , raw_event: raw_event) @thread_id = thread_id @run_id = run_id @result = result @outcome = outcome end |
Instance Attribute Details
#outcome ⇒ Object (readonly)
Returns the value of attribute outcome.
1015 1016 1017 |
# File 'lib/ag_ui_protocol/core/events.rb', line 1015 def outcome @outcome end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
1012 1013 1014 |
# File 'lib/ag_ui_protocol/core/events.rb', line 1012 def result @result end |
#run_id ⇒ Object (readonly)
Returns the value of attribute run_id.
1009 1010 1011 |
# File 'lib/ag_ui_protocol/core/events.rb', line 1009 def run_id @run_id end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
1006 1007 1008 |
# File 'lib/ag_ui_protocol/core/events.rb', line 1006 def thread_id @thread_id end |
Instance Method Details
#to_h ⇒ Object
1047 1048 1049 |
# File 'lib/ag_ui_protocol/core/events.rb', line 1047 def to_h super.merge(thread_id: @thread_id, run_id: @run_id, result: @result, outcome: @outcome) end |