Package com.tnsai.agents.interrupt
Record Class InterruptEvent.BudgetInterrupt
java.lang.Object
java.lang.Record
com.tnsai.agents.interrupt.InterruptEvent.BudgetInterrupt
- All Implemented Interfaces:
InterruptEvent
- Enclosing interface:
InterruptEvent
public static record InterruptEvent.BudgetInterrupt(String reason, Instant timestamp, String budgetType, double currentUsage, double limit)
extends Record
implements InterruptEvent
Budget interrupt when token/cost limits are hit.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.agents.interrupt.InterruptEvent
InterruptEvent.BudgetInterrupt, InterruptEvent.ErrorInterrupt, InterruptEvent.ExternalInterrupt, InterruptEvent.TimeoutInterrupt, InterruptEvent.UserInterrupt -
Constructor Summary
ConstructorsConstructorDescriptionBudgetInterrupt(String budgetType, double currentUsage, double limit) BudgetInterrupt(String reason, Instant timestamp, String budgetType, double currentUsage, double limit) Creates an instance of aBudgetInterruptrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebudgetTyperecord component.doubleReturns the value of thecurrentUsagerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns true if the agent can be resumed after this interrupt.doublelimit()Returns the value of thelimitrecord component.reason()Returns the value of thereasonrecord component.booleanReturns true if the agent should checkpoint its state.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BudgetInterrupt
-
BudgetInterrupt
public BudgetInterrupt(String reason, Instant timestamp, String budgetType, double currentUsage, double limit) Creates an instance of aBudgetInterruptrecord class.- Parameters:
reason- the value for thereasonrecord componenttimestamp- the value for thetimestamprecord componentbudgetType- the value for thebudgetTyperecord componentcurrentUsage- the value for thecurrentUsagerecord componentlimit- the value for thelimitrecord component
-
-
Method Details
-
shouldCheckpoint
public boolean shouldCheckpoint()Description copied from interface:InterruptEventReturns true if the agent should checkpoint its state.- Specified by:
shouldCheckpointin interfaceInterruptEvent
-
isResumable
public boolean isResumable()Description copied from interface:InterruptEventReturns true if the agent can be resumed after this interrupt.- Specified by:
isResumablein interfaceInterruptEvent
-
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 '=='. -
reason
Returns the value of thereasonrecord component.- Specified by:
reasonin interfaceInterruptEvent- Returns:
- the value of the
reasonrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceInterruptEvent- Returns:
- the value of the
timestamprecord component
-
budgetType
Returns the value of thebudgetTyperecord component.- Returns:
- the value of the
budgetTyperecord component
-
currentUsage
public double currentUsage()Returns the value of thecurrentUsagerecord component.- Returns:
- the value of the
currentUsagerecord component
-
limit
public double limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-