Record Class RunConfig

java.lang.Object
java.lang.Record
com.tnsai.reliability.RunConfig
Record Components:
maxDuration - hard wall-clock cap; the orchestrator aborts with AbortReason.MAX_DURATION_EXCEEDED when crossed
costCeilingUSD - optional spend cap in USD; empty disables runtime cost-ceiling checks (the run still participates in any external budget enforcement, just not at the loop level)
checkpointInterval - minimum gap between forced checkpoints; the orchestrator may also checkpoint on every step boundary, but this caps the worst-case replay window after a crash
maxRetries - per-step retry budget before the orchestrator gives up and marks the run failed
progressTimeout - declare a run "stuck" when no Progress event has been emitted within this window — orientation cue for operators

public record RunConfig(Duration maxDuration, Optional<BigDecimal> costCeilingUSD, Duration checkpointInterval, int maxRetries, Duration progressTimeout) extends Record
Execution-time policy bundle for one run of a ResumableRun (TNS-299). Caps duration, cost, retry attempts, and checkpoint cadence — every long-running agent execution should be bounded along these axes, otherwise a runaway loop is indistinguishable from real work.

USD is the only currency the framework acknowledges today (matches the cost-governance layer in tnsai-quality.cost). Currency unification is explicitly out of scope for the framework primitives.

Since:
0.10.0 (TNS-299)
  • Constructor Details

    • RunConfig

      public RunConfig(Duration maxDuration, Optional<BigDecimal> costCeilingUSD, Duration checkpointInterval, int maxRetries, Duration progressTimeout)
      Creates an instance of a RunConfig record class.
      Parameters:
      maxDuration - the value for the maxDuration record component
      costCeilingUSD - the value for the costCeilingUSD record component
      checkpointInterval - the value for the checkpointInterval record component
      maxRetries - the value for the maxRetries record component
      progressTimeout - the value for the progressTimeout record component
  • Method Details

    • defaults

      public static RunConfig defaults()
      Sensible defaults for a multi-hour overnight run: 8h max, no cost ceiling (consumer wires cost-governance separately when needed), 5-minute checkpoint cap, 3 retries, 10-minute progress timeout.
    • builder

      public static RunConfig.Builder builder()
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • maxDuration

      public Duration maxDuration()
      Returns the value of the maxDuration record component.
      Returns:
      the value of the maxDuration record component
    • costCeilingUSD

      public Optional<BigDecimal> costCeilingUSD()
      Returns the value of the costCeilingUSD record component.
      Returns:
      the value of the costCeilingUSD record component
    • checkpointInterval

      public Duration checkpointInterval()
      Returns the value of the checkpointInterval record component.
      Returns:
      the value of the checkpointInterval record component
    • maxRetries

      public int maxRetries()
      Returns the value of the maxRetries record component.
      Returns:
      the value of the maxRetries record component
    • progressTimeout

      public Duration progressTimeout()
      Returns the value of the progressTimeout record component.
      Returns:
      the value of the progressTimeout record component