KestraKVMemory​Kestra​K​V​Memory

In-memory Chat Memory that then store its serialization form as a Kestra K/V pair

It will store the memory inside a K/V pair, the name of the entry will be the memory id and it will expires after the memory TTL. Be careful that if your internal storage implementation didn't support expiration, the K/V pair may exist forever even if you set a TTL inside the Memory.

yaml
type: "io.kestra.plugin.ai.memory.KestraKVMemory"

Store chat memory inside a K/V pair.

yaml
id: chat-with-memory
namespace: company.team

inputs:
  - id: first
    type: STRING
    defaults: Hello, my name is John
  - id: second
    type: STRING
    defaults: What's my name?

tasks:
  - id: first
    type: io.kestra.plugin.ai.rag.ChatCompletion
    chatProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-2.5-flash
      apiKey: "{{ secret('GEMINI_API_KEY') }}"
    embeddingProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-embedding-exp-03-07
      apiKey: "{{ secret('GEMINI_API_KEY') }}"
    embeddings:
      type: io.kestra.plugin.ai.embeddings.KestraKVStore
    memory:
      type: io.kestra.plugin.ai.memory.KestraKVMemory
    systemMessage: You are an 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: "{{ secret('GEMINI_API_KEY') }}"
    embeddingProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-embedding-exp-03-07
      apiKey: "{{ secret('GEMINI_API_KEY') }}"
    embeddings:
      type: io.kestra.plugin.ai.embeddings.KestraKVStore
    memory:
      type: io.kestra.plugin.ai.memory.KestraKVMemory
      drop: true
    systemMessage: You are an helpful assistant, answer concisely
    prompt: "{{inputs.second}}"
Properties
Default false

Drop the memory at the end of the task.

By default, the memory ID is value of the 'system.correlationId' label, this means that the same memory will be used by all tasks of the flow and its subflow. If you want to remove the memory eagerly (before expiration), you can set drop: true inside the last task of the flow so the memory is erased after its execution.

Default {{ labels.system.correlationId }}

The memory id. Defaults to the value of the 'system.correlationId' label. This means that a memory is valid for the whole flow execution including its subflows.

Default 10

The maximum number of messages to keep inside the memory.

Default PT1H
Format duration

The memory duration. Defaults to 1h.