Superbrain is a next-generation distributed memory fabric designed for AI agents. It transforms passive storage into a cognitive participant in your agentic workflows.
Traditional databases treat data as static bytes to be retrieved. Superbrain treats data as Active Memoryβwith semantic awareness, intentional decay, and microsecond-latency sharing between co-located and distributed agents.
Superbrain separates the **Control Plane** (Metadata, Consensus, Routing) from the **Data Plane** (Raw Bytes, mmap, rDMA). This allows for extreme horizontal scale without impacting metadata consistency.
Establishing a new pointer requires a ROUND TRIP to the Coordinator. However, Superbrain SDKs implement a local **Pointer Map Cache**. Once a 36-byte UUID is resolved to a node's IP:
Read/Write calls bypass the Coordinator entirely.Active Memory transforms distributed storage into a cognitive participant. Unlike Redis or S3, Superbrain understands the "liveliness" and "intent" of the data it stores.
Every write can have a liveliness score (0.0 to 1.0). The node runs a background **Forgetter** loop that scans blocks periodically.
When multiple agents write to the same context, Superbrain resolves logical conflicts using **Semantic Locking** held at the Intent level.
Superbrain automatically routes data between these four tiers based on proximity and configuration.
| Tier | Latency | Mechanism | Durability |
|---|---|---|---|
| L1: SHM Bypass | ~13ΞΌs | mmap /dev/shm | Volatile (Node) |
| L2: Distributed RAM | ~1.2ms | gRPC Streaming | Volatile (Cluster) |
| L3: KV Cache Pool | ~5ms | zlib Compression | Managed RAM |
| L4: Durable Storage | ~50ms | WAL / Write-Behind | Permanent |
Get your agent swarm up and running in minutes.
pip install superbrain-sdk
npm install superbrain-distributed-sdk
go get github.com/golightstep/superbrainSdk
from superbrain import SuperbrainClient
client = SuperbrainClient("localhost:50050")
# Write to distributed RAM
ptr_id = client.allocate(1024)
client.write(ptr_id, 0, b"Agent State Alpha")
const { SuperbrainClient } = require('superbrain-distributed-sdk');
const client = new SuperbrainClient('localhost:50050');
const ptrId = await client.allocate(1024);
await client.write(ptrId, 0, Buffer.from("Agent State Alpha"));
client := sdk.NewClient("localhost:50050")
ptr, _ := client.Allocate(1024)
client.Write(ptr.ID, 0, []byte("Agent State Alpha"))
Tune every aspect of the SDK and Cluster behavior. Superbrain supports configuration via Environment Variables (recommended for containers) or explicit `Config` objects.
| Parameter | Default | Description | |
|---|---|---|---|
SB_COORDINATOR | localhost:50050 | Primary gRPC endpoint. Comma-separate for HA pools. | |
SB_ENCRYPTION_KEY | null | 32-byte key for E2EE. Enabling this wraps all IO in AES-GCM. | |
SB_BYPASS_LOCAL | true | If node IP is 127.0.0.1, use SHM for 15ΞΌs latency bypass. | |
SB_MTLS_ENABLE | false | Force mutual TLS certification for all agent operations. |
| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | ./sb_data | Root directory for FileStore/WAL. |
wal_sync_mode | string | none | always for synchronous fsync, none for OS buffering. |
max_queue_size | int | 10000 | Bounded write-behind queue size before backpressure kicks in. |
compress | bool | true | Enable zlib compression for L3 tier blocks. |
Superbrain includes an optional persistence layer designed for minimal impact on the RAM fabric's performance. It uses an asynchronous Write-Behind pattern to offload I/O while maintaining in-memory speed.
To prevent data loss in the async queue during a crash, Superbrain records every write task in a local Write-Ahead Log before acknowledging it to the agent's RAM. On restart, the node automatically replays the WAL to recover any unsaved blocks.
filestore provider automatically activates the WAL in the same directory.
# Start node with Durable Local Storage
./bin/node --persistence-provider=filestore \
--persistence-config='{"path": "/var/lib/superbrain", "wal_sync_mode": "always"}'
Configure the L3 tier by passing provider-specific JSON via the --persistence-config flag.
./bin/node --persistence-provider=filestore \
--persistence-config='{"path": "/data", "wal_sync_mode": "always"}'
./bin/node --persistence-provider=redis \
--persistence-config='{"addr": "localhost:6379", "db": 0}'
./bin/node --persistence-provider=postgres \
--persistence-config='{"dsn": "postgres://user:pass@host:5432/db"}'
Superbrain is designed for untrusted environments. It uses a dual-layer security model to protect both communication and data.
Every node and agent must be enrolled in the cluster's private PKI. The Coordinator acts as a Certificate Authority (CA), issuing short-lived certificates upon successful registration.
When enabled via SB_ENCRYPTION_KEY, the SDK wraps all memory writes in AES-GCM-256. Infrastructure nodes only see encrypted entropy, ensuring your agent's private reasoning remains private.
client = superbrain.Client(encryption_key=KEY_32_BYTES)
const client = new SuperbrainClient(addr, { encryptionKey: KEY_32_BYTES });
client, _ := sdk.NewClientWithEncryption(key, addr)
The first step for any secure agent. This method performs an mTLS handshake, generates a local keypair, and obtains a signed certificate from the Coordinator CA.
# Identity enrollment in the Secure Fabric
client.register("research-agent-01")
// Enrollment is required before any Write/Allocate
await client.register("research-agent-01");
err := client.Register("research-agent-01")
For distributed agents, Superbrain uses a Raft-based consensus protocol to manage Semantic Locks. This prevents logical race conditions where two agents might attempt to "read-modify-write" a shared reasoning state simultaneously.
Intent level, allowing for high-concurrency writes to different logical goals within the same memory block.
Superbrain provides three primary API tiers. Level 1 is the Raw Pointer API, offering maximum performance and control over byte offsets.
Reserves chunks of RAM across the distributed fabric. Returns a 36-byte UUID pointer.
# π Secure Client (mTLS + E2EE)
client = superbrain.Client(
coordinators=["coord:50050"],
encryption_key=os.getenv("SB_KEY")
)
# Allocate 50MB
ptr_id = client.allocate(50 * 1024 * 1024)
print(f"Memory ready: {ptr_id}")
// Allocate 50MB
const ptrId = await client.allocate(50 * 1024 * 1024);
console.log(`Memory ready: ${ptrId}`);
// Allocate 50MB
ptr, err := client.Allocate(50 * 1024 * 1024)
fmt.Printf("Memory ready: %s\n", ptr.ID)
size | uint64 | Number of bytes to allocate. |
ERR_QUOTA_EXHAUSTED: Cluster has no free RAM in this tier.ERR_COORD_UNREACHABLE: Metadata resolve failed.Enriches raw data writes with semantic metadata. This is the foundation of Superbrain's "Cognitive Architecture".
summary | string | LLM-readable summary of the chunk content. |
intent | string | The logical purpose of this write (e.g. "Drafting Plan"). |
liveliness | float (0-1) | Sets the decay rate. 0.1 = ephemeral, 1.0 = persistent. |
# Write with metadata and 30-day "half-life"
client.write_cognitive(
ptr_id, offset=0, data=b"...",
liveliness=0.8,
intent="Strategic Planning",
summary="Agent decision to expand search",
tag="Critical"
)
await client.writeCognitive(ptrId, 0, data, {
liveliness: 0.8,
intent: "Strategic Planning",
summary: "Agent decision to expand search",
tag: "Critical"
});
client.WriteCognitive(ptr, 0, data, sdk.CognitiveOptions{
Liveliness: 0.8,
Intent: "Strategic Planning",
Summary: "Agent decision to expand search",
Tag: "Critical",
})
Registers a reactive trigger that wakes your agent up when any other agent in the fabric writes with a matching semantic intent.
def on_user_goal(notify):
print(f"Goal Detected: {notify.summary}")
# Block until a 'User Goal' is written to the fabric
client.semantic_subscribe("User Goal", on_user_goal)
client.semanticSubscribe('User Goal', (notify) => {
console.log(`Goal Detected: ${notify.summary}`);
});
client.SemanticSubscribe("User Goal", func(n *sdk.Notification) {
fmt.Printf("Goal Detected: %s\n", n.Summary)
})
One agent downloads a 500MB PDF. Instead of sending the PDF to 10 other agents, it writes to Superbrain and shares the 36-byte pointer via a message bus.
An execution agent is writing logs. A security agent subscribes to tag="Sensitive". The moment the executor writes an API key by mistake, the security agent is woken up by Superbrain to scrub the memory and flag the breach.
A Go ingestion agent writes high-speed telemetry. A Python agent reads the same offsets for ML inference. Superbrain handles the byte-order and mmap alignment automatically.
A Memory Node experiences a hardware power failure while holding critical agent context. Because Level 4 (FileStore) was enabled: