FabricFabricHarness
EcosystemDatabases

Redis

Use Redis for complete runtime persistence or governed agent key-value tools.

Redis has two separate integration surfaces:

  • redisPersistence() stores sessions, durable submissions, conversation offsets, attachments, runs, and cost budgets for Node runtimes.
  • redisTools() gives an agent bounded key-value capabilities. It does not expose persistence internals to the model.

Runtime persistence

Install the official Redis client alongside the Node runtime:

pnpm add @fabric-harness/node redis
.fabricharness/config.ts
import { redisPersistence, type FabricHarnessConfig } from '@fabric-harness/node';
import { createClient } from 'redis';

export default async function config(): Promise<FabricHarnessConfig> {
  const client = createClient({ url: process.env.REDIS_URL });
  await client.connect();

  return {
    persistence: redisPersistence({
      client,
      namespace: 'production',
      ttlSeconds: 30 * 24 * 60 * 60,
    }),
  };
}

All keys share a namespace-specific Redis Cluster hash tag. Mutations use an ownership-checked Lua commit, concurrent cost reservations are atomic, and binary attachments are preserved byte for byte. ttlSeconds applies sliding retention to persisted state; omit it when retention is managed externally. Use TLS, ACL credentials limited to the namespace, replication, and a persistence mode appropriate for your recovery objective.

The same bundle works with Valkey deployments that support the Redis command and Lua surface used by the injected client. CI runs the complete persistence contract against Redis 7.4, including claims, settlement, fencing, restart recovery, deletion, one-megabyte attachments, and concurrency.

Governed agent tools

Install the namespaced Redis tool recipe:

fh add database redis
const [get, set] = redisTools({
  client,
  prefix: 'prod:acme',
  maxValueBytes: 64 * 1024,
  defaultTtlSeconds: 3600,
});

Every key is prefixed by application code. Values are size-bounded, writes can receive a TTL, and redis_set is marked effect: 'write'. The package intentionally exposes no script, admin, flush, or arbitrary-command tool. Use TLS and least-privilege ACL credentials.