
AI KestraKVStore
CertifiedPersist chat memory in Kestra KV
AI KestraKVStore
Persist chat memory in Kestra KV
Caches chat messages in-memory and saves them to a namespace KV entry keyed by memoryId; TTL sets KV expiry, but some backends may ignore it. drop=AFTER_TASKRUN deletes the KV after use.
type: io.kestra.plugin.ai.memory.KestraKVStoreExamples
Store chat memory inside a KV pair
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-3.5-flash-lite
apiKey: "{{ secret('GEMINI_API_KEY') }}"
embeddingProvider:
type: io.kestra.plugin.ai.provider.GoogleGemini
modelName: gemini-embedding-001
apiKey: "{{ secret('GEMINI_API_KEY') }}"
embeddings:
type: io.kestra.plugin.ai.embeddings.KestraKVStore
memory:
type: io.kestra.plugin.ai.memory.KestraKVStore
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-3.5-flash-lite
apiKey: "{{ secret('GEMINI_API_KEY') }}"
embeddingProvider:
type: io.kestra.plugin.ai.provider.GoogleGemini
modelName: gemini-embedding-001
apiKey: "{{ secret('GEMINI_API_KEY') }}"
embeddings:
type: io.kestra.plugin.ai.embeddings.KestraKVStore
memory:
type: io.kestra.plugin.ai.memory.KestraKVStore
drop: AFTER_TASKRUN
systemMessage: You are a helpful assistant, answer concisely
prompt: "{{ inputs.second }}"
Properties
drop string
NEVERNEVERBEFORE_TASKRUNAFTER_TASKRUNWhen to drop the memory
Controls when the stored conversation is erased, rather than waiting for ttl to expire. NEVER (default) keeps it until expiry, BEFORE_TASKRUN clears it before the task runs, and AFTER_TASKRUN clears it once the task run completes.
memoryId string
{{ labels.system.correlationId }}Memory ID
Identifier under which the conversation is stored, so that different runs or users can keep separate histories. Defaults to the system.correlationId label, which makes one memory span an entire flow execution including its subflows.
messages integerstring
10Maximum messages in memory
Number of chat messages retained in memory. When the limit is reached, the oldest messages are evicted first (FIFO); the last system message is always kept. Defaults to 10.
ttl string
PT1HMemory duration
How long the memory is retained before it expires. Defaults to PT1H (one hour).