ExAthena.Modes.PlanAndSolve (ExAthena v0.4.9)

Copy Markdown View Source

Plan-and-Solve mode.

Two-phase operation: on the first iteration, the agent is asked to plan before it acts. Subsequent iterations execute the plan using ExAthena.Modes.ReAct's standard cycle.

Rationale (Plan-and-Solve literature): models produce better tool-calling behaviour when they articulate a plan before diving into actions. Forcing the first turn to be planning-only prevents the "immediate tool call" failure mode you see with small models on complex prompts.

State

Plan-mode state is kept in state.mode_state[:phase]:

  • :planning — on the first iteration. A planning-only system-prompt addendum is injected, forbidding tool calls.
  • :executing — subsequent iterations fall through to the ReAct cycle.

Configuration

ExAthena.run(prompt, mode: :plan_and_solve, )

No extra options. The planning system prompt is hardcoded; consumers who want a custom planning instruction should implement their own Mode (the ReAct module is 200 lines of reference).