NeuroValkey Agents uses Valkey as a multi-agent AI swarm backbone
Harish Kotra built NeuroValkey Agents, a 3-agent Node.js swarm where Valkey serves as the central orchestration substrate using Pub/Sub, vector search, JSON, and Hashes — not merely as a cache.
Score breakdown
Developers building multi-agent systems can adopt this pattern to make swarm state fully observable and debuggable by externalizing orchestration into Valkey primitives instead of opaque in-process memory.
- 013-agent Node.js swarm: Researcher (generates/stores facts), Writer (KNN retrieval + drafting), Editor (grading + final output)
- 02Valkey serves as the central runtime substrate using Pub/Sub, Search (vector), JSON, and Hashes
- 03Facts are embedded with OpenAI and stored in Valkey Hash keys as FLOAT32 vectors with COSINE distance metric
Harish Kotra's NeuroValkey Agents project demonstrates a 3-agent Node.js swarm where Valkey acts as the central runtime substrate for multi-agent coordination. The three agents have distinct roles: Agent 1 (Researcher) generates facts and stores vector memory, Agent 2 (Writer) retrieves semantic context via KNN search and drafts summary text, and Agent 3 (Editor) grades the draft and writes the final output. Rather than coupling control flow to application memory — which makes state invisible and hard to debug — the design externalizes all swarm state into Valkey using four primitives: Pub/Sub channels for explicit orchestration, JSON keys for durable run snapshots, Hash keys for vectorized facts, and a Search index for semantic retrieval.
The implementation uses raw `FT.CREATE` and `FT.SEARCH` commands via `valkey.call()` for explicit control and module compatibility.
The implementation uses raw `FT.CREATE` and `FT.SEARCH` commands via `valkey.call()` for explicit control and module compatibility. Each fact is embedded using OpenAI and written to a `fact:` Hash key with `FLOAT32` vectors using `COSINE` distance metric. KNN queries are issued with `FT.SEARCH` using `DIALECT 2`, and matched keys are hydrated with `HMGET`. Workflow state changes are persisted with `JSON.SET` and retrieved with `JSON.GET`, enabling reproducibility and UI introspection. A live UI at `http://localhost:3055` displays the keyspace map, raw JSON for manifests and drafts, vector fact records, Search index telemetry from `FT.INFO`, and a full event timeline.
The article documents several deliberate architectural tradeoffs: polling over SSE/WebSockets for zero-infra local demo reliability, a Hash + JSON hybrid model to match each data access pattern, and raw Search commands over abstraction libraries for compatibility visibility. Kotra outlines future directions including SSE/WebSocket upgrades, run history, configurable agent DAGs, retry/backoff with dead-letter channels, benchmark mode, and distributed trace IDs. The source code is available on GitHub at `harishkotra/neurovalkey-agents`.
Key facts
- 013-agent Node.js swarm: Researcher (generates/stores facts), Writer (KNN retrieval + drafting), Editor (grading + final output)
- 02Valkey serves as the central runtime substrate using Pub/Sub, Search (vector), JSON, and Hashes
- 03Facts are embedded with OpenAI and stored in Valkey Hash keys as FLOAT32 vectors with COSINE distance metric
- 04Raw FT.CREATE / FT.SEARCH commands used via valkey.call() for explicit control and module compatibility
- 05