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: criticapprovedboolean. - 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 withbeamandmctsstrategies. - Key controls:max_depth,branch_factor,beam_width,search_strategy,mcts_exploration_weight, andsimulation_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: evaluatorscorecrossesconsensus_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
ProposeCriticPatternwhen you want a strict two-role revision contract with explicit approval semantics.Use
TreeSearchPatternwhen you want branching search over alternatives and deterministic score-driven pruning/selection.Use
RalphLoopPatternwhen you want 3+ ordered roles and a separate evaluator scoring consensus quality each round.Use
NominalTeamPatternwhen you want diverse independent drafts first and only compare/select after generation.
Examples#
examples/patterns/tree_search.pyexamples/patterns/ralph_loop.pyexamples/patterns/nominal_team.pyexamples/patterns/propose_critic.pyexamples/patterns/rag.py