()
| 121 | } |
| 122 | |
| 123 | public ExitReason check() { |
| 124 | if (stagnant) { |
| 125 | return ExitReason.STAGNATION_DETECTED; |
| 126 | } |
| 127 | if (totalInputTokens + totalOutputTokens >= tokenBudget) { |
| 128 | return ExitReason.TOKEN_BUDGET_EXCEEDED; |
| 129 | } |
| 130 | if (iteration >= hardMaxIterations) { |
| 131 | return ExitReason.HARD_ITERATION_LIMIT; |
| 132 | } |
| 133 | return ExitReason.WITHIN_BUDGET; |
| 134 | } |
| 135 | |
| 136 | public int iteration() { |
| 137 | return iteration; |
no outgoing calls