跪拜 Guibai
← All articles
Backend

Spring AI 2.1 Adds Tool Call Confirmation, Ordered Reasoning Parts, and a Dedicated DecisionModel

By 苏三说技术 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Production agents can now pause tool execution before high-stakes calls without hand-rolled state management, and reasoning replay across Anthropic, Gemini, and OpenAI no longer requires model-specific shims. The deprecation of ChatMemory, however, forces migration on teams that already standardized on 2.0.

Summary

Spring AI 2.1.0, released November 19, 2026, tackles the gap between demo agents and agents that handle consequential actions. The headline feature is Tool Call Confirmation: an annotation on a tool method makes the framework pause the entire tool call loop before execution, return the pending calls to the application, and resume with explicit allow/deny decisions. The pause is stateless; it's just a normal response, and resuming is a normal request, so apps that persist the conversation can survive restarts and multi-instance deployments.

For reasoning-heavy models, 2.1 replaces the old text-plus-lists message structure with an ordered MessagePart list. ReasoningPart, ToolCallPart, TextPart, and others retain the exact order the model emitted them. That matters because Anthropic requires thinking blocks to be replayed with signatures in order, Gemini 3+ rejects function calls when thought signatures move parts, and OpenAI Responses needs encrypted content replayed. The framework now handles these per-model quirks.

The release also adds an OpenAI Responses endpoint (one property to switch), a DecisionModel interface that returns calibrated probabilities instead of generated text for classification, streaming tool-call parameter updates, broader vector store support for custom embeddings, and a Session API that deprecates ChatMemory. For teams pushing agents into production, the upgrade buys real safety controls, but the deprecation and version differences bring migration costs.

Takeaways
— Release date: November 19, 2026, half a year after Spring AI 2.0 GA.
— Tool Call Confirmation uses @Tool(requiresConfirmation = true) to pause the whole tool loop before execution and lets the app pass allow/deny decisions via ToolCallDecision.
— Pause/resume is stateless: a pause is a normal response and a resume is a normal request, so restart and multi-instance recovery works if the app persists the conversation.
— ToolCallConfirmationPolicy can select tools by metadata, specify external tools with forTools(...), or use a lambda to check parameters.
— Message Parts are ordered TextPart, ReasoningPart, ToolCallPart, ToolResultPart, MediaPart, and UnknownPart segments preserving the model's original output order.
— Anthropic requires thinking blocks with signatures returned as-is; Gemini 3+ requires thought signatures in their original Parts; OpenAI Responses requires encrypted_content for reasoning replay.
— Message Parts only work in OpenAiResponsesChatModel in M1; other ChatModel implementations were refactored in RC1.
— Switching to OpenAI Responses API is a single property: spring.ai.openai.chat.api=responses, and OpenAiResponsesChatModel is stateless.
— DecisionModel (RC2) returns Choice, Noul, and Score answers with calibrated probabilities; implementations exist for OpenAI, Ollama (d1-omni:600m), and System One (manual TypeSafeClient).
— Streaming tool call parameters are now exposed incrementally; partial ToolCallParts are ignored by getToolCalls() and ToolCallingManager.
— VectorStore.upsert and similaritySearch with custom vectors were extended to Neo4j, MongoDB Atlas, Typesense, MariaDB, and Chroma in RC2.
— ChatMemory and related types are deprecated in 2.1, replaced by the Session API with Turns and composable compaction strategies.
— Cross-agent human confirmation flow is in the Spring AI Agent roadmap, not part of 2.1 core.
Conclusions

Treating model tool calls as fallible enough to require an explicit confirmation gate marks a shift from prompt-engineering assumptions to operational controls in AI frameworks.

The ChatMemory deprecation signals a move toward composable conversation state, but it will force 2.0 adopters to redesign conversation handling before they can use 2.1's new features.

DecisionModel narrows LLM classification to calibrated probabilities, yet teams still set thresholds manually, so it is an improvement over parsing text but not a set-and-forget solution.

Concepts & terms
Tool Call Confirmation
A Spring AI 2.1 feature that pauses the tool execution loop before a model-invoked tool runs, lets the application approve or deny each call, and resumes without holding state.
Message Parts
An ordered list of content segments (text, reasoning, tool calls, media, etc.) that preserves the exact order the model produced, enabling faithful replay of reasoning and tool interactions.
DecisionModel
A new interface for classification tasks that returns calibrated probabilities (choice, yes/no, score) instead of free-form text, allowing direct threshold-based decisions.
OpenAI Responses API
A REST endpoint that supports combining tool calls with reasoning effort settings, required for GPT-5.4 and later in agent workflows; Spring AI switches to it with one property.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗