⚡ Multi-step reasoning, Chain-of-Thought (CoT), Tree-of-Thoughts (ToT), and heuristic path evaluation — Deep cognitive planning engine for the FastJava AI ecosystem.
FastAIReasoner provides structured cognitive search and reasoning capabilities for Java AI agents. It evaluates solution paths, explores branch states, and performs self-consistency verification before actions are executed in FastAIAgent or FastAIRuntime.
importfastai.AI;
importfastai.FastAI;
importfastaireasoner.FastAIReasoner;
importfastaireasoner.ReasoningResult;
publicclassDemo {
publicstaticvoidmain(String[] args) {
AIbrain = FastAI.connect("ollama:qwen2.5-coder:7b");
// 1. Instantiate reasoning engine with Tree-of-Thoughts (ToT) strategyFastAIReasonerreasoner = FastAIReasoner.treeOfThoughts(brain, 3/* branches */, 2/* depth */);
// 2. Perform deep reasoning on complex architectural problemReasoningResultresult = reasoner.reason("Design a lock-free event dispatcher in Java");
System.out.println("Best Plan: " + result.bestPath());
System.out.println("Confidence: " + result.confidenceScore());
}
}- Why FastAIReasoner?
- Key Features
- Reasoning Strategies
- Architecture Overview
- API Quick Reference
- Installation
- Documentation
- Platform Support
- License
- Related Projects
Standard LLM prompting produces linear, error-prone responses on multi-step logic and coding tasks. FastAIReasoner delivers:
- State-Space Exploration — Explores alternative reasoning branches before committing to an action.
- Self-Consistency Scoring — Samples multiple rationale paths and ranks the most reliable outcome.
- Agent Integration — Directly plugs into
FastAIAgent's planning and reflection phases. - Zero Framework Overhead — Pure Java 17+ with sub-millisecond graph evaluation.
- 🌲 Tree-of-Thoughts (ToT) — Explores tree-structured rationale paths with branch pruning.
- 🔗 Chain-of-Thought (CoT) — Step-by-step sequential deduction with explicit verification gates.
- 🎯 Monte Carlo Tree Search (MCTS) — Rollout simulations and heuristic value scoring for complex goal decomposition.
- ⚡ Fast Reflection & Self-Healing — Evaluates execution anomalies and generates counter-plans.
FastAIReasoner (The Reasoner & Planning Engine)
Evaluates cognitive hypotheses, scores branches, and outputs optimal execution plans.
FastAIAgent (The Mind)
Consumes reasoning plans and orchestrates the ReAct loop (Observe → Plan → Act → Reflect → Memory).
FastAIRuntime (The Body)
Executes the deterministic tool actions selected by the reasoner.
| Method / Factory | Return Type | Description |
|---|---|---|
FastAIReasoner.chainOfThought(AI) | FastAIReasoner | Sequential reasoning pipeline with step validation. |
FastAIReasoner.treeOfThoughts(AI, int, int) | FastAIReasoner | Branching tree search exploring multiple candidate thoughts. |
FastAIReasoner.mcts(AI, int) | FastAIReasoner | Heuristic Monte Carlo search for strategic planning. |
reasoner.reason(String goal) | ReasoningResult | Evaluates the goal and returns the highest-scoring plan path. |
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastAIReasoner</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastai</artifactId>
<version>0.1.7</version>
</dependency>
</dependencies>MIT License — See LICENSE file for details.
- FastAI — Unified AI client interface for Java
- FastAIAgent — Autonomous agent loop, intent-graphs, and tool execution
- FastAIBot — Zero-bloat bot harnesses and persona runtime
- FastAIGraph — In-memory knowledge graph and multi-hop relationship engine
- FastAIHybrid — Dense-sparse hybrid search fusion (BM25 + Vectors)
- FastAIMCP — Model Context Protocol (MCP) server & tool integration
- FastAIMemory — Conversation history, sliding windows, and rolling summaries
- FastAIModel — Native local inference runtime (GGUF/ONNX)
- FastAIRag — Ultra-fast document chunking and vector retrieval
- FastAIReasoner — Deterministic planning, chain-of-thought, and self-correction
- FastAIRerank — Cross-encoder relevance filtering and Top-N prompt pruner
- FastAIRuntime — Sandboxed process runner and tool-calling execution pipeline
- FastAIVectorDB — High-throughput SIMD/AVX2 vector database
- FastCore — Unified JNI loader and platform abstraction
Part of the FastJava Ecosystem — Making the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋
