Feature Request: Native Tree of Thoughts (ToT) Framework & Advisor Implementation
Pre-Check
I have searched all open and closed GitHub issues, and there is no existing feature request or implementation for a framework-level Tree of Thoughts (ToT) module. Only a basic manual prompt example exists in the official documentation.
Expected Behavior
I expect Spring AI to provide a native, reusable, Spring-idiomatic Tree of Thoughts (ToT) module integrated with the existing ChatClient and Advisors API, to support complex multi-path reasoning scenarios. The expected features include:
-
Core Pluggable Abstractions
- Standardized domain model
Thought to represent nodes in the reasoning tree, including content, parent/child relationships, score, depth and other core attributes.
- Three core strategy interfaces for full customization:
ThoughtGenerator: Generate multiple candidate reasoning steps/solutions for the current node.
ThoughtEvaluator: Score and evaluate the validity and feasibility of each generated thought (0.0-1.0).
SearchStrategy: Define tree traversal logic, with built-in implementations for BFS, DFS and Beam Search.
-
Seamless Spring AI Ecosystem Integration
- Implement
TreeOfThoughtsAdvisor that directly fits the existing Advisor system, which can be added to ChatClient with zero additional code changes, consistent with the current developer experience.
- Provide a fluent
TreeOfThoughtsConfig builder to configure core parameters: max depth, candidates per step, evaluation threshold, custom strategy injection, etc.
-
Out-of-the-Box Default Implementations
- Provide production-ready default implementations for all core interfaces, so developers can enable ToT capability without writing custom logic.
- Built-in optimized prompt templates for generation and evaluation, compatible with all major model providers supported by Spring AI.
-
Developer-Friendly Usage
- Support one-line enablement for ToT via default advisor, while allowing full customization of each component for advanced scenarios.
- Expose full thought tree trace for debugging and observability, to help developers understand the model's reasoning process.
Current Behavior
Currently, Spring AI does not have a framework-level Tree of Thoughts implementation:
- Only a simplified manual prompt example is provided in the "Prompt Engineering Patterns" chapter of the official documentation, which is a hardcoded scenario demo, not a reusable general component.
- There is no dedicated ToT module or Advisor in the existing codebase, and no related abstractions for the ToT pattern.
- Developers have to write a large amount of repeated custom prompt logic, orchestration code and evaluation rules from scratch for complex reasoning scenarios (mathematical problem solving, strategic planning, code generation with multi-path exploration), which is inefficient, difficult to maintain, and inconsistent with Spring's "convention over configuration" philosophy.
Context
- Industry Value: Tree of Thoughts is a critical advanced reasoning pattern that significantly improves LLM performance on complex tasks that require exploration and strategic thinking, which is a must-have capability for enterprise-level AI application development.
- Ecosystem Parity: Other mainstream AI frameworks (LangChain, LangChain4j) have provided mature ToT implementations, and Spring AI's native support will fill this major gap and enhance the competitiveness of the framework.
- Compatibility: The proposed design fully follows Spring AI's existing architecture, does not break any existing APIs, and can be released as an independent
spring-ai-advisors-tree-of-thoughts module.
- Reference: Official manual ToT example in documentation: https://docs.spring.io/spring-ai/reference/api/chat/prompt-engineering-patterns.html#_tree_of_thoughts_tot
Feature Request: Native Tree of Thoughts (ToT) Framework & Advisor Implementation
Pre-Check
I have searched all open and closed GitHub issues, and there is no existing feature request or implementation for a framework-level Tree of Thoughts (ToT) module. Only a basic manual prompt example exists in the official documentation.
Expected Behavior
I expect Spring AI to provide a native, reusable, Spring-idiomatic Tree of Thoughts (ToT) module integrated with the existing
ChatClientandAdvisorsAPI, to support complex multi-path reasoning scenarios. The expected features include:Core Pluggable Abstractions
Thoughtto represent nodes in the reasoning tree, including content, parent/child relationships, score, depth and other core attributes.ThoughtGenerator: Generate multiple candidate reasoning steps/solutions for the current node.ThoughtEvaluator: Score and evaluate the validity and feasibility of each generated thought (0.0-1.0).SearchStrategy: Define tree traversal logic, with built-in implementations for BFS, DFS and Beam Search.Seamless Spring AI Ecosystem Integration
TreeOfThoughtsAdvisorthat directly fits the existing Advisor system, which can be added toChatClientwith zero additional code changes, consistent with the current developer experience.TreeOfThoughtsConfigbuilder to configure core parameters: max depth, candidates per step, evaluation threshold, custom strategy injection, etc.Out-of-the-Box Default Implementations
Developer-Friendly Usage
Current Behavior
Currently, Spring AI does not have a framework-level Tree of Thoughts implementation:
Context
spring-ai-advisors-tree-of-thoughtsmodule.