Warning
π§ WIP β Active AI Pipeline Construction & Architecture Optimization in Progress.
β‘ 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.
import fastai.AI;
import fastai.FastAI;
import fastaireasoner.FastAIReasoner;
import fastaireasoner.ReasoningResult;
public class Demo {
public static void main(String[] args) {
AI brain = FastAI.connect("ollama:qwen2.5-coder:7b");
// 1. Instantiate reasoning engine with Tree-of-Thoughts (ToT) strategy
FastAIReasoner reasoner = FastAIReasoner.treeOfThoughts(brain, 3 /* branches */, 2 /* depth */);
// 2. Perform deep reasoning on complex architectural problem
ReasoningResult result = 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
- Architecture Overview
- API Quick Reference
- Technical Demos & Benchmarks
- Installation
- Documentation
- Platform Support
- License
- Related Projects
Standard LLM prompting generates linear, token-by-token text without internal verification, leading to hallucinations, circular logic, and brittle plans in multi-step enterprise workflows. FastAIReasoner transforms raw generative models into disciplined problem-solving engines through deliberate heuristic search and self-evaluation:
- State-Space Exploration β Explores alternative branching thoughts before committing to irreversible actions.
- Self-Consistency Scoring β Samples multiple rationale paths and ranks the most dependable strategy.
- Agent Integration β Directly plugs into
FastAIAgent's planning and reflection phases. - Zero Framework Overhead β Pure Java 17+ architecture with sub-millisecond graph evaluation.
| Feature | Standard LLM Prompting | LangChain / LangGraph | FastAIReasoner |
|---|---|---|---|
| Reasoning Model | Linear single-pass | Graph DSL overhead | Chain-of-Thought & Tree-of-Thoughts |
| Branch Exploration | β None | β Native multi-branch state evaluation | |
| Confidence Scoring | β None | β Built-in confidence metrics | |
| Memory Footprint | Low | High (Python / bulky JVM) | Zero-bloat, pure Java 17+ |
| Ecosystem Synergy | Standalone | Fragmented | Native fit with FastAI & FastAIAgent |
- π² 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.
- π― Confidence Scoring β Evaluates rationale coherence with threshold-based confidence checks.
- β‘ Zero-Bloat Cognitive Engine β Lightweight Java record structures and lock-free execution.
- π Seamless FastAI Integration β Works out-of-the-box with any model supported by
FastAI.
- π§ 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 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. |
reasoner.reason(String goal) |
ReasoningResult |
Evaluates the goal and returns the highest-scoring plan path. |
result.isConfident() |
boolean |
Verifies whether confidence score meets threshold (>= 0.70). |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Cognitive Planning Demo | Demo.java | run-demo.bat |
Chain-of-Thought (CoT) and Tree-of-Thoughts (ToT) multi-branch planning demo. |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
JMH throughput benchmark measuring deduction and state exploration speed. |
Add the JitPack repository and the dependencies to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- FastAIReasoner Library -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastAIReasoner</artifactId>
<version>0.1.0</version>
</dependency>
<!-- FastAI (Unified AI Client) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastai</artifactId>
<version>0.1.4</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastAIReasoner:0.1.0'
implementation 'com.github.andrestubbe:fastai:0.1.4'
}Download the latest JARs directly to add them to your classpath:
- π¦ FastAIReasoner-0.1.0.jar (The Core Library)
- βοΈ fastcore-0.1.0.jar (The Mandatory Native Loader)
- REFERENCE.md: Core API reference manual.
- PHILOSOPHY.md: Multi-step reasoning and cognitive planning architecture.
- COMPILE.md: Build instructions.
- CHANGELOG.md: Project history and releases.
- ROADMAP.md: Future milestones.
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
- FastAIEval β Ultra-fast LLM & agent evaluation framework
- FastAIGraph β In-memory knowledge graph and multi-hop relationship engine
- FastAIGuard β Fast guardrails, prompt safety, and hallucination containment
- FastAIHybrid β Dense-sparse hybrid search fusion (BM25 + Vectors)
- FastAIMatcher β Automated SOX compliance and hybrid rule matching engine
- FastAIMCP β Model Context Protocol (MCP) server & tool integration
- FastAIMemory β Conversation history, sliding windows, and rolling summaries
- FastAIMemoryGraph β Graph-based episodic and associative memory engine
- FastAIMetrics β Ultra-fast lock-free token, latency, cost tracking and evaluation engine
- FastAIModel β Native local inference runtime (GGUF/ONNX)
- FastAIRag β Ultra-fast document chunking and vector retrieval
- FastAIRerank β Cross-encoder relevance filtering and Top-N prompt pruner
- FastAIRuntime β Sandboxed process runner and tool-calling execution pipeline
- FastAISandbox β Lightweight isolated execution environment for untrusted AI tools
- FastAISkill β Modular capability registry and dynamic tool dispatch
- FastAIState β Lock-free shared agent state & blackboard memory
- FastAIVectorDB β High-throughput SIMD/AVX2 vector database
- FastAIVision β High-speed local multimodal vision, UI-element grounding, and screen-VLM engine
- FastCore β Unified JNI loader and platform abstraction
Part of the FastJava Ecosystem β Making the JVM faster. Small package. Maximum speed. Zero bloat. ππ
