Enforces iteration budget limits.
If the current iteration count has reached max_iterations - 1 (i.e.
this is the last allowed iteration), halts the pipeline with an error
decision. Future extensions may add token budget and cost budget
enforcement.
Skips processing when the decision is already :done (no tool calls)
or when the pipeline is in error status.
Analogous to budget guard clauses in step-oriented loop executors: that check recursion depth before proceeding.
Summary
Functions
Checks iteration count against max_iterations.
Functions
@spec call( LlmCore.Agent.Context.t(), keyword() ) :: LlmCore.Agent.Context.t()
Checks iteration count against max_iterations.
Parameters
ctx—%Context{}withiterationandmax_iterationsopts— ALF stage options (unused)
Returns
- Unchanged context when within budget
- Context with
status: :erroranddecision: {:error, :budget_exceeded}when the iteration limit is reached