In-memory Chat Memory that stores its data as Kestra KV pairs
Memory stored as a KV pair with key named after the memory id and expiration date defined by the TTL property. If your internal storage implementation doesn't support expiration, the KV pair may persist despite the TTL.
type: "io.kestra.plugin.ai.memory.KestraKVStore"
Examples
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-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.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-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.KestraKVStore
drop: AFTER_TASKRUN
systemMessage: You are a helpful assistant, answer concisely
prompt: "{{inputs.second}}"
Properties
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.
ttl string
PT1H
duration
Memory duration - defaults to 1h