Reasoning Patterns#

Reasoning capabilities are exposed as reusable pattern implementations rather than prompt-only conventions.

Available patterns#

  • ProposeCriticPattern - Iterative two-role propose/critic refinement. - Stop signal: critic approved boolean. - Typical output focus: latest approved proposal text + critique history. - Background references: Self-Refine; Reflexion. Conceptual grounding only; behavior is defined by repository contracts and implementation.

  • TreeSearchPattern - Generator + evaluator delegate orchestration with beam and mcts strategies. - Key controls: max_depth, branch_factor, beam_width, search_strategy, mcts_exploration_weight, and simulation_budget. - Stop signal: depth/search budget exhaustion or no expansions. - Typical output focus: best candidate + scored frontier diagnostics. - Background references: Tree of Thoughts. Conceptual grounding only; this implementation uses framework-native step orchestration.

  • RalphLoopPattern - Dynamic role-ordered loop with dedicated evaluator role, threshold-based stopping, and configurable selection strategy. - Stop signal: evaluator score crosses consensus_threshold (or max-iteration fallback). - Typical output focus: selected synthesis + per-role iteration history.

  • NominalTeamPattern - Independent member fan-out followed by evaluator-driven best-of-N selection. - Stop signal: evaluator selects one candidate, or the run fails if no candidate can be selected. - Typical output focus: selected candidate + per-member generation diagnostics.

  • RAGPattern - Retrieval-augmented reasoning with memory read/write workflow primitives. - Background references: Retrieval-Augmented Generation (RAG). Conceptual grounding only; this pattern composes retrieval and context injection at workflow level.

Tree search output#

TreeSearchPattern returns:

{
    "final_output": {
        "best_candidate": {...},
        "best_score": float,
    },
    "details": {
        "explored_nodes": int,
        "frontier_trace": [...],
    },
    "terminated_reason": str,
}

Pattern differentiation (quick)#

  • Use ProposeCriticPattern when you want a strict two-role revision contract with explicit approval semantics.

  • Use TreeSearchPattern when you want branching search over alternatives and deterministic score-driven pruning/selection.

  • Use RalphLoopPattern when you want 3+ ordered roles and a separate evaluator scoring consensus quality each round.

  • Use NominalTeamPattern when you want diverse independent drafts first and only compare/select after generation.

Examples#

  • examples/patterns/tree_search.py

  • examples/patterns/ralph_loop.py

  • examples/patterns/nominal_team.py

  • examples/patterns/propose_critic.py

  • examples/patterns/rag.py