Chat Memory backed by Redis
Persist chat memory in a Redis store using the memory ID as the key. The Redis entry will expire after the provided TTL. Ensure your Redis instance is reachable and configured via environment or plugin properties.
type: "io.kestra.plugin.ai.memory.Redis"
Examples
Use Redis-based chat memory for a conversation
id: "redis"
type: "io.kestra.plugin.ai.memory.Redis"
id: chat_with_memory
namespace: company.ai
inputs:
- id: first
type: STRING
defaults: Hello, my name is John and I'm from Paris
- id: second
type: STRING
defaults: What's my name and where am I from?
tasks:
- id: first
type: io.kestra.plugin.ai.rag.ChatCompletion
chatProvider:
type: io.kestra.plugin.ai.provider.GoogleGemini
modelName: gemini-2.5-flash
apiKey: "{{ kv('GEMINI_API_KEY') }}"
embeddingProvider:
type: io.kestra.plugin.ai.provider.GoogleGemini
modelName: gemini-embedding-exp-03-07
apiKey: "{{ kv('GEMINI_API_KEY') }}"
embeddings:
type: io.kestra.plugin.ai.embeddings.KestraKVStore
memory:
type: io.kestra.plugin.ai.memory.Redis
host: localhost
port: 6379
systemMessage: You are a helpful assistant, answer concisely
prompt: "{{inputs.first}}"
- id: second
type: io.kestra.plugin.ai.rag.ChatCompletion
chatProvider:
type: io.kestra.plugin.ai.provider.GoogleGemini
modelName: gemini-2.5-flash
apiKey: "{{ kv('GEMINI_API_KEY') }}"
embeddingProvider:
type: io.kestra.plugin.ai.provider.GoogleGemini
modelName: gemini-embedding-exp-03-07
apiKey: "{{ kv('GEMINI_API_KEY') }}"
embeddings:
type: io.kestra.plugin.ai.embeddings.KestraKVStore
memory:
type: io.kestra.plugin.ai.memory.Redis
host: localhost
port: 6379
drop: AFTER_TASKRUN
systemMessage: You are a helpful assistant, answer concisely
prompt: "{{inputs.second}}"
Properties
host *Requiredstring
Redis host
The hostname of your Redis server (e.g., localhost or redis-server)
drop string
NEVER
NEVER
BEFORE_TASKRUN
AFTER_TASKRUN
Drop memory: never, before, or after the agent's task run
By default, the memory ID is the value of the system.correlationId
label, meaning that the same memory will be used by all tasks of the flow and its subflows.
If you want to remove the memory eagerly (before expiration), you can set drop: AFTER_TASKRUN
to erase the memory after the taskrun.
You can also set drop: BEFORE_TASKRUN
to drop the memory before the taskrun.
memoryId string
{{ labels.system.correlationId }}
Memory ID - defaults to the value of the system.correlationId
label. This means that a memory is valid for the entire flow execution including its subflows.
messages integerstring
10
Maximum number of messages to keep in memory. If memory is full, the oldest messages will be removed in a FIFO manner. The last system message is always kept.
port integerstring
6379
Redis port
The port of your Redis server
ttl string
PT1H
duration
Memory duration - defaults to 1h