Package com.tnsai.quality.cost
Class BudgetExceededException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.tnsai.exceptions.TnsAIException
com.tnsai.quality.cost.BudgetExceededException
- All Implemented Interfaces:
Serializable
public class BudgetExceededException
extends com.tnsai.exceptions.TnsAIException
Thrown by
CostBudgetEnforcer when an LLM call would exceed
a configured CostBudget under BudgetPolicy.HARD_STOP
(issue #82).
Carries the budget identity (tenant / agent / capability / period), the measured spend, the budget cap, and the estimated cost of the blocked call so the caller can either fall back to a cheaper model, defer the work, or surface a clear "budget exhausted" signal to the user.
- Since:
- 0.10.0 (issue #82 closeout — cost-governance hook wiring)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBudgetExceededException(String tenantId, String scope, BigDecimal budgetUSD, BigDecimal spentUSD, BigDecimal estimatedUSD) -
Method Summary
Methods inherited from class com.tnsai.exceptions.TnsAIException
getContext, getErrorCode, getMaxRetryAttempts, getMessage, getSuggestedRetryDelayMs, getThrownAt, isRetryable, wrapMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
BudgetExceededException
public BudgetExceededException(String tenantId, String scope, BigDecimal budgetUSD, BigDecimal spentUSD, BigDecimal estimatedUSD) - Parameters:
tenantId- tenant whose budget was hitscope- human-readable scope label (e.g. "tenant", "agent:foo", "capability:summarise")budgetUSD- configured cap for the periodspentUSD- cumulative spend already recordedestimatedUSD- pre-call estimate that pushed over the cap
-
-
Method Details
-
getTenantId
-
getScope
-
getBudgetUSD
-
getSpentUSD
-
getEstimatedUSD
-