@kuralle-agents/redis-store
v0.11.0
Published
Redis-backed SessionStore for Kuralle (supports Upstash and common Redis clients)
Downloads
3,759
Readme
@kuralle-agents/redis-store
Redis-backed session store, memory service, and vector store for Kuralle.
Install
npm install @kuralle-agents/redis-storePeers: @kuralle-agents/core @kuralle-agents/rag.
What it does
Three backend implementations — sessions, long-term memory, and vector search — all backed by Redis. Works with Upstash, node-redis, ioredis, or any client that exposes compatible get / set / del commands.
Key exports:
RedisSessionStore—SessionStoreimplementation for durable session persistence.RedisMemoryService—MemoryServiceimplementation for cross-session long-term memory.RedisPersistentMemoryStore—PersistentMemoryStorefor durable USER/MEMORY markdown blocks.RedisVectorStore—VectorStoreCoreimplementation for vector similarity search.fromUpstash/fromNodeRedis/fromIORedis— client adapters.
Session store
import { createRuntime } from '@kuralle-agents/core';
import { RedisSessionStore, fromUpstash } from '@kuralle-agents/redis-store';
import { Redis } from '@upstash/redis';
const sessionStore = fromUpstash(Redis.fromEnv(), { prefix: 'kuralle' });
const runtime = createRuntime({
agents: [agent],
defaultAgentId: 'support',
sessionStore,
});Client adapters
node-redis:
import { createClient } from 'redis';
import { fromNodeRedis } from '@kuralle-agents/redis-store';
const client = createClient({ url: process.env.REDIS_URL });
await client.connect();
const sessionStore = fromNodeRedis(client, { prefix: 'kuralle' });ioredis:
import Redis from 'ioredis';
import { fromIORedis } from '@kuralle-agents/redis-store';
const client = new Redis(process.env.REDIS_URL);
const sessionStore = fromIORedis(client, { prefix: 'kuralle' });Direct constructor (any compatible client):
import { RedisSessionStore } from '@kuralle-agents/redis-store';
const sessionStore = new RedisSessionStore({ client: myClient, prefix: 'kuralle' });Store options
prefix(default:'kuralle') — key namespace.sessionTtlSeconds— optional TTL for session keys.enableCleanupIndex(default:true) — maintain a sorted set for cleanup byupdatedAt.
Long-term memory
import { createRuntime, InMemoryMemoryService } from '@kuralle-agents/core';
import { RedisMemoryService, fromUpstash } from '@kuralle-agents/redis-store';
const redis = fromUpstash(Redis.fromEnv());
const memoryService = new RedisMemoryService({ client: redis });
const runtime = createRuntime({
agents: [agent],
defaultAgentId: 'support',
memoryService,
preloadMemory: true,
memoryIngestion: 'onEnd',
});Working memory blocks
import { createRuntime } from '@kuralle-agents/core';
import { RedisPersistentMemoryStore, fromUpstash } from '@kuralle-agents/redis-store';
import { Redis } from '@upstash/redis';
const client = Redis.fromEnv();
const workingMemoryStore = new RedisPersistentMemoryStore({ client, prefix: 'kuralle' });
const runtime = createRuntime({
agents: [agent],
defaultAgentId: 'support',
defaultWorkingMemoryStore: workingMemoryStore,
});On Cloudflare Workers, use fromUpstash with the REST client — no TCP socket required.
Related
@kuralle-agents/core—SessionStoreinterface and runtime.@kuralle-agents/rag—VectorStoreCoreinterface.@kuralle-agents/postgres-store— Postgres alternative.
