β‘ High-performance lock-free shared blackboard memory, delta revision tracking, and binary state snapshot engine for multi-agent workflows.
FastAIState provides a shared blackboard coordination memory for multi-agent execution graphs, automated task pipelines, and tool execution environments. It eliminates prompt context stuffing by offering a lock-free, thread-safe, observable key-value store with atomic CAS (Compare-And-Swap), delta tracking, and zero-allocation binary serialization via FastFileFormat & FastBinary.
import fastaistate.*;
public class Example {
public static void main(String[] args) {
FastBlackboard blackboard = FastAIState.of("workflow-task-1");
// 1. Reactive listener
blackboard.addListener("agent_status", (key, oldVal, newVal) -> {
System.out.println("Status changed: " + newVal.value());
});
// 2. Write state
blackboard.set("agent_status", "PLANNING");
// 3. Atomic CAS update
long ver = blackboard.getEntry("agent_status").version();
blackboard.compareAndSet("agent_status", ver, "EXECUTING");
// 4. Compact FastFileFormat Binary Snapshot
byte[] binary = FastStateSerializer.toBinary(blackboard.snapshot());
FastBlackboard restored = FastStateSerializer.fromBinary(binary);
}
}- β‘ Lock-Free Concurrency β Atomic CAS (
compareAndSet) updates with monotonically increasing generation revisions. - π Delta & Revision Tracking β Microsecond delta extraction (
getDeltasSince) to stream state diffs across distributed workers. - π‘ Reactive State Listeners β Key-specific and global change listeners (
StateChangeListener) for event-driven orchestration. - πΎ FastFileFormat State Snapshots β Dual-format state serialization (
FastStateSerializer) with standard 12-byte header and VarInt streams. - π Zero Dependencies β Native-speed pure Java 17+ architecture backed by
FastCore,FastBinary, andFastFileFormat.
- π€ Multi-Agent Coordination β Shared blackboard for planner, coder, and reviewer subagents without prompt token pollution.
- π οΈ Tool & Environment State β Storing live workspace variables, session parameters, and execution flags across tool calls.
- π Session Checkpoints & Replays β Saving point-in-time state snapshots to disk for deterministic re-runs and rollbacks.
- β‘ Reactive UI & Telemetry Synchronization β Hooking UI panels and console monitors directly to state mutation events.
FastAIState is profiled using JMH to guarantee ultra-low latency and lock-free execution under massive concurrency.
| Benchmark Operation | Score (ops/ms) | Ops per Second | Memory Allocation |
|---|---|---|---|
| Compare-And-Swap (CAS) | ~302,000 ops/ms | > 302 Million | 0 bytes / op (Zero GC) |
| Blackboard State Read | ~104,000 ops/ms | > 104 Million | 0 bytes / op (Zero GC) |
| Blackboard State Write | ~15,500 ops/ms | > 15.5 Million | Minimal entry overhead |
| Binary State Snapshot Serialization | ~93,000 ops/ms | > 93,000 / sec | High-density VarInt stream |
| Binary State Snapshot Deserialization | ~82,000 ops/ms | > 82,000 / sec | Zero-copy decoding |
Run the benchmarks locally: .\run-benchmark.bat
| Method / Class | Description |
|---|---|
FastAIState.of("scopeId") |
Gets or creates a scoped shared blackboard instance. |
blackboard.set("key", value) |
Sets a state value and bumps the global revision version. |
blackboard.get("key") |
Retrieves a state value by key. |
blackboard.compareAndSet(key, ver, val) |
Atomically updates value if expected version matches. |
blackboard.addListener(key, listener) |
Registers a reactive change listener for a specific key. |
blackboard.getDeltasSince(version) |
Returns list of state entries modified after given revision. |
FastStateSerializer.toBinary(snapshot) |
Encodes state snapshot into a compact FastBinary payload. |
FastStateSerializer.fromBinary(bytes) |
Restores blackboard state from binary bytes. |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Multi-Agent Blackboard Coordination | Demo.java | run-demo.bat |
Reactive listeners, atomic CAS updates across agents, and binary state serialization. |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
Lock-free CAS throughput, concurrent blackboard reads/writes, and snapshot serialization. |
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastAIState</artifactId>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastFileFormat</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastBinary</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastcore</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastAIState:0.1.1'
implementation 'com.github.andrestubbe:FastFileFormat:0.1.0'
implementation 'com.github.andrestubbe:FastBinary:0.1.0'
implementation 'com.github.andrestubbe:fastcore:0.1.0'
}Download the latest JARs directly to add them to your classpath:
- π§ FastAIState-0.1.1.jar (Shared Blackboard Engine)
- π FastFileFormat-0.1.0.jar (Dual Binary & Text File Format)
- β‘ FastBinary-0.1.0.jar (VarInt & Binary Packing)
- βοΈ fastcore-0.1.0.jar (Foundation Library)
- REFERENCE.md: Full API reference and method signatures.
- PHILOSOPHY.md: Architectural design principles and lock-free goals.
- CHANGELOG.md: Release history and version notes.
- ROADMAP.md: Future milestones and planned features.
- COMPILE.md: Instructions for compiling from source.
| Platform | Status |
|---|---|
| Windows 10/11 (x64) | β Fully Supported |
| Linux | β Fully Supported |
| macOS | β Fully Supported |
MIT License. See LICENSE file for details.
- FastAI β Unified AI client interface for Java
- FastAIAgent β Autonomous agent loop, intent-graphs, and tool execution
- FastAIRuntime β Sandboxed process runner and FastAIEventBus pipeline
- FastFileFormat β Universal dual-format binary & text document engine
- FastBinary β Zero-bloat VarInt encoding and bitstream packing
- FastCore β Unified JNI loader and platform abstraction
Part of the FastJava Ecosystem β Making the JVM faster. Small package. Maximum speed. Zero bloat. ππ