LlmCore.Agent.Components.LoopDecision (llm_core v0.3.0)

Copy Markdown View Source

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

call(ctx, opts)

Sets the decision field based on pipeline processing results.

Parameters

  • ctx%Context{} after all prior stages
  • opts — 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