Chapter 10: Short-term memory with Spring AI Session

Spring AI Session stores every message and tool call in PostgreSQL. Spring AI’s JDBC chat memory drops tool call messages, so this course does not use it. The workflow id is the session id.

sessions.appendMessage(sessionId, new UserMessage(question));
List<Message> history = sessions.getMessages(sessionId);
Figure 10.1. The database keeps everything. The harness decides how much of it to send. The figure leaves out how the window is chosen; the chapter leaves that open.

The full history stays in the database. The window sent to the model is a separate choice. Verify the bean name and the create signature in the Session README.

docs