Determines whether the outer loop should continue or stop.
If this stage is reached with non-empty result_messages, the decision
is {:continue, messages} — the outer loop appends these messages and
calls the LLM again.
If no tool calls survived validation and the decision was not already set
to :done by ParseToolCalls, this stage defaults to {:done, response}.
Emits the [:llm_core, :agent, :loop_iteration] telemetry event.
Analogous to a projection stage: the final stage that packages the pipeline output into the contract the consumer expects.
Summary
Functions
Sets the decision field based on pipeline processing results.
Functions
@spec call( LlmCore.Agent.Context.t(), keyword() ) :: LlmCore.Agent.Context.t()
Sets the decision field based on pipeline processing results.
Parameters
ctx—%Context{}after all prior stagesopts— ALF stage options (unused)
Returns
Updated %Context{} with decision set to one of:
{:continue, messages}— tool calls executed, loop again{:done, response}— no more tool calls, return final response