Agentic.Loop.Stages.ModeRouter (agentic v0.2.2)

Copy Markdown

Mode-aware routing stage. Replaces StopReasonRouter.

Routes based on the triple (mode, phase, stop_reason) to decide what to do with the LLM response. All phase transitions go through Phase.transition/2.

Routing Table

ModePhaseStop ReasonAction
:agentic:executeend_turnAccumulate text → next (CommitmentGate)
:agentic:executetool_useStore pending_tool_calls → next (ToolExecutor)
:agentic_planned:planend_turnParse plan → transition to :execute → reentry
:agentic_planned:executeend_turnAccumulate text → next (CommitmentGate)
:agentic_planned:executetool_useStore pending_tool_calls → next (ToolExecutor)
:agentic_planned:verifyend_turnAccumulate verification result → done
:turn_by_turn:reviewend_turnBuild proposal → next (HumanCheckpoint)
:turn_by_turn:reviewtool_useStore pending_tool_calls → next (ToolExecutor)
:turn_by_turn:executeend_turnTransition to :review → reentry
:turn_by_turn:executetool_useStore pending_tool_calls → next (ToolExecutor)
:conversational:executeend_turnAccumulate text → done
anyanymax_tokensReturn what we have → done

Callbacks

Optional callbacks on ctx.callbacks:

  • :on_response_facts - (ctx, text) -> :ok
  • :on_persist_turn - (ctx, text) -> :ok