Package com.tnsai.events
Record Class RunEndEvent
java.lang.Object
java.lang.Record
com.tnsai.events.RunEndEvent
- Record Components:
eventId- unique identifier for this eventtimestamp- when the event occurredrunId- the run identifier (matches RunStartEvent)status- the completion status (COMPLETED, FAILED, CANCELLED)result- the final result (for successful runs)durationMs- total execution duration in milliseconds
- All Implemented Interfaces:
TnsAIEvent
public record RunEndEvent(String eventId, Instant timestamp, String runId, RunEndEvent.RunStatus status, String result, long durationMs)
extends Record
implements TnsAIEvent
Event indicating that an agent run has completed.
RunEndEvent is emitted when a chat/run execution finishes, either successfully or with an error.
This event is paired with RunStartEvent.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRunEndEvent(String eventId, Instant timestamp, String runId, RunEndEvent.RunStatus status, String result, long durationMs) Creates an instance of aRunEndEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic RunEndEventCreates a cancelled run end event.static RunEndEventCreates a successful run end event.longReturns the value of thedurationMsrecord component.final booleanIndicates whether some other object is "equal to" this one.eventId()Returns the value of theeventIdrecord component.static RunEndEventCreates a failed run end event.final inthashCode()Returns a hash code value for this object.result()Returns the value of theresultrecord component.runId()Returns the value of therunIdrecord component.status()Returns the value of thestatusrecord component.static RunEndEventCreates a timed out run end event.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface com.tnsai.events.TnsAIEvent
eventType
-
Constructor Details
-
RunEndEvent
public RunEndEvent(String eventId, Instant timestamp, String runId, RunEndEvent.RunStatus status, String result, long durationMs) Creates an instance of aRunEndEventrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentrunId- the value for therunIdrecord componentstatus- the value for thestatusrecord componentresult- the value for theresultrecord componentdurationMs- the value for thedurationMsrecord component
-
-
Method Details
-
completed
Creates a successful run end event.- Parameters:
runId- the run identifierresult- the final resultdurationMs- execution duration- Returns:
- new RunEndEvent
-
failed
Creates a failed run end event.- Parameters:
runId- the run identifierdurationMs- execution duration- Returns:
- new RunEndEvent
-
cancelled
Creates a cancelled run end event.- Parameters:
runId- the run identifierdurationMs- execution duration- Returns:
- new RunEndEvent
-
timedOut
Creates a timed out run end event.- Parameters:
runId- the run identifierdurationMs- execution duration- Returns:
- new RunEndEvent
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
eventId
Returns the value of theeventIdrecord component.- Specified by:
eventIdin interfaceTnsAIEvent- Returns:
- the value of the
eventIdrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceTnsAIEvent- Returns:
- the value of the
timestamprecord component
-
runId
Returns the value of therunIdrecord component.- Returns:
- the value of the
runIdrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
result
Returns the value of theresultrecord component.- Returns:
- the value of the
resultrecord component
-
durationMs
public long durationMs()Returns the value of thedurationMsrecord component.- Returns:
- the value of the
durationMsrecord component
-