A root budget bounds one task end to end. Every request made on the task's
behalf (first attempt, retry, repair follow-up, continuation, Flow lane,
chunk or resumed run) reserves from the same object, so no loop can spend
more than the root allows.
Output tokens are reserved at the request's ceiling and settled afterwards:
provider-reported output is charged exactly; unreported output is charged at
the full reservation, except a request that streamed nothing, which is
charged no output (it still counts as a request).
A budget is plain data, so it can be persisted with the operation that owns
it and restored (restoreRootBudget) without resetting what was spent.
A root budget bounds one task end to end. Every request made on the task's behalf (first attempt, retry, repair follow-up, continuation, Flow lane, chunk or resumed run) reserves from the same object, so no loop can spend more than the root allows.
Output tokens are reserved at the request's ceiling and settled afterwards: provider-reported output is charged exactly; unreported output is charged at the full reservation, except a request that streamed nothing, which is charged no output (it still counts as a request).
A budget is plain data, so it can be persisted with the operation that owns it and restored (
restoreRootBudget) without resetting what was spent.