SpringAiChatHistoryProvider

class SpringAiChatHistoryProvider(repository: ChatMemoryRepository, dispatcher: CoroutineDispatcher) : ChatHistoryProvider(source)

A conversation text memory bridge between a Spring AI ChatMemoryRepository and a Koog ChatHistoryProvider.

This adapter targets repositories that persist only Spring AI messageType and text (e.g., JdbcChatMemoryRepository). It is not a lossless Koog persistence adapter — only plain-text conversational messages survive the round-trip.

Persistable message types (text-only)

Silently dropped on store

The following Koog message types are non-persistable transport/runtime events and are filtered out before delegation to the underlying ChatMemoryRepository:

Silently skipped on load

Spring AI TOOL rows (e.g., from JDBC repositories that previously stored tool traffic) are skipped rather than causing an error, since they cannot be meaningfully mapped back to Koog messages.

Metadata fields such as timestamps, token counts, finish reasons, and custom metadata are not preserved through the round-trip.

Parameters

repository

the Spring AI ChatMemoryRepository to delegate to

dispatcher

the CoroutineDispatcher used for blocking repository calls

Constructors

Link copied to clipboard
constructor(repository: ChatMemoryRepository, dispatcher: CoroutineDispatcher)

Functions

Link copied to clipboard
open suspend override fun load(conversationId: String): List<Message>
Link copied to clipboard
open suspend override fun store(conversationId: String, messages: List<Message>)