Dev News Daily ENDE

Spring AI 2.1 stores messages as ordered parts so model reasoning survives replay

Spring AI 2.1 rebuilds how a message is represented: content is no longer a string with side lists but a sequence of typed pieces kept in the order the model produced them, the Spring team explains in a post dated 28 October. Each piece — prose, model thinking, a tool invocation — is mapped from what providers call content blocks (Anthropic, Bedrock), parts (Gemini), items (OpenAI Responses) or chunks (Mistral).

The reason is reasoning models. Anthropic's models attach a signature to their thinking, Google's attach signatures to function calls, and OpenAI's Responses API hands back reasoning in encrypted form; each provider expects that data back unchanged and in order on the next request. Dropping or reordering them can mean an HTTP 400 or a model that silently loses its earlier reasoning. Before 2.1, text, tool calls and media sat in separate fields, opaque data lived in provider-specific metadata, streaming often kept only the last fragment of thinking, and the JDBC chat memory stored only text and message type.

MessagePart is a sealed interface with six record implementations. Opaque payloads such as an Anthropic signature are carried as OpaquePayload(provider, kind, data) and replayed only to the provider that produced them; anything a model does not understand becomes an UnknownPart and is passed back as-is. With 2.1.0-RC1, OpenAI Responses, Anthropic, Google GenAI, OpenAI Chat Completions, Ollama, Bedrock Converse, DeepSeek and Mistral produce and consume parts, and a new Session memory persists them. Existing constructors and builders still work, and getText(), getToolCalls() and getMedia() become views over the parts; code that read reasoning through provider-specific types is what most likely needs changes.

Spring AI 2.1 stores messages as ordered parts so model reasoning survives replay
Spring AI 2.1 stores messages as ordered parts so model reasoning survives replay — Dev News Daily

What it means

The three rules in the post — keep the order, replay verbatim, persist parts rather than text — apply to any framework talking to reasoning models, not just Spring. Teams storing conversation history as plain text are exactly the ones who will see multi-turn tool use degrade without an obvious error. Note that 2.1 is at release-candidate stage.

Written by Victoria Shinder.