Redis
Use Redis as the storage adapter for memory, runs, and streams.
Install
npm install @better-agent/redis redisSetup
Pass a connected Redis client to redisStorage.
import { betterAgent } from "@better-agent/core";
import { redisStorage } from "@better-agent/redis";
import { createClient } from "redis";
const client = await createClient({
url: process.env.REDIS_URL,
}).connect();
export const app = betterAgent({
storage: redisStorage({
client,
}),
agents: [supportAgent],
});Options
| Option | Description |
|---|---|
client | Connected Redis client. |
base | Base key namespace. |
prefixes | Per-model key prefixes. |
transforms | Per-field encode and decode hooks for stored data. |
Notes
Redis works well for run resume and stream replay when Redis durability is enabled.
The adapter can use redis or @upstash/redis.
For Upstash, install @upstash/redis instead of redis.
See Storage for what Better Agent stores.
Powered by Farming Labs ORM.