Skip to content

Repository files navigation

Warning

🚧 WIP β€” Active AI Pipeline Construction & Architecture Optimization in Progress.

FastAIReasoner [ALPHA-2026-09-01] β€” Multi-Step Reasoning & Cognitive Planning Engine for Java

Status License: MIT Java Platform JitPack


⚑ 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.

FastAIReasoner Cognitive Strategies


Quick Start

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());
    }
}

Table of Contents


Why FastAIReasoner?

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 ⚠️ Heavyweight agent graphs βœ… Native multi-branch state evaluation
Confidence Scoring ❌ None ⚠️ Ad-hoc prompts βœ… 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

Key Features

  • 🌲 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.

Architecture Overview

  • 🧠 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.

API Quick Reference

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).

Technical Demos & Benchmarks

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.

Installation

Option 1: Maven (Recommended)

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>

Option 2: Gradle (via JitPack)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:FastAIReasoner:0.1.0'
    implementation 'com.github.andrestubbe:fastai:0.1.4'
}

Option 3: Direct Download (No Build Tool)

Download the latest JARs directly to add them to your classpath:

  1. πŸ“¦ FastAIReasoner-0.1.0.jar (The Core Library)
  2. βš™οΈ fastcore-0.1.0.jar (The Mandatory Native Loader)

Documentation


Platform Support

Operating System Architecture Build Status Support Level
Windows 10 / 11 x64 Passing Tier 1 (Primary / Optimized)
Linux (Ubuntu / RHEL) x64 Passing Tier 1 (Pure Java Engine)
macOS (Sonoma+) Apple Silicon (arm64) Passing Tier 1 (Pure Java Engine)
macOS x64 Passing Tier 2 (Supported)

License

MIT License β€” See LICENSE file for details.


Related Projects

  • 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. πŸš€πŸ“‹

About

🧠 Multi-step reasoning, Chain-of-Thought (CoT), Tree-of-Thoughts (ToT), and heuristic planning engine for Java.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages