跪拜 Guibai
← Back to the summary

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

Spring AI 2.1 official release adds an important feature

Preface

Hello everyone, I'm Su San.

On November 19, 2026, Spring AI 2.1.0 was officially released.

To be honest, this release caught me a bit off guard.

Spring AI 2.0 GA was only half a year ago, and 2.1 is already here. And this version isn't just "patching things up"; it's aimed at the deep-water zone of Agent deployment.

Why do I say that?

Because 2.1 solves a problem that everyone building enterprise-grade Agents has to face: Should model-invoked tools be trusted unconditionally?

Some of you might have encountered this at work: you built an intelligent customer service Agent that can check orders, change addresses, and initiate refunds. It tested fine, but after going live, one day the model "is in a bad mood" and refunds an order that shouldn't have been refunded. You dig into the logs and find it did invoke the refund tool with the correct parameters, but the judgment was wrong.

The model isn't stupid; it's that the framework layer lacks a "manual confirmation" gate.

2.1 turns this gate into an official capability.

This article walks through Spring AI 2.1, hoping it helps you.

More project practice at Java Commando website: susan.net.cn/project

1. Core Changes

1.1 How it was done before, and why it was painful

Before 2.1, if you wanted to add a confirmation step before tool calls, you had to hack it yourself.

You had to wrap a layer around ToolCallingManager, intercept the model's tool call request, pause the loop, wait for human decision, and then feed the result back.

The logic isn't hard to write, but it's hard to get right.

Where do you store the paused state?

What happens if the service restarts?

In a multi-instance deployment, what if the decision request lands on a different machine? How do you find the paused context?

Most teams just don't do it.

High-risk tools are either disabled outright, or they rely on "good luck" by putting a line in the prompt like "please be careful."

1.2 2.1's approach: framework-level pause and resume

2.1 introduces Tool Call Confirmation in RC1.

You add an annotation to a tool method:

@Tool(description = "Book a flight", requiresConfirmation = true)
String bookFlight(String flightNumber) {
    return bookingService.book(flightNumber);
}

When the model wants to call this tool, the entire tool call loop pauses before executing any calls, returns the reply to the application, and lists all pending confirmations.

The application collects each call's ToolCallDecision (allow, or deny with a message), then calls ToolCallingManager.executeToolCalls(prompt, reply, decisions) to execute the calls in the reply and sends the result back as the next request.

Rejected calls return your message to the model instead of actually executing.

Key design: The loop holds no state while waiting.

Pausing is an ordinary response return; resuming is an ordinary request send.

As long as your application saves the conversation, it can resume even after a service restart.

Which calls need confirmation is determined by ToolCallConfirmationPolicy: the default policy reads tool metadata, forTools(...) lets you specify tools you don't own (like MCP tools), and a lambda can inspect parameters (for example, only confirm transfers above a certain amount).

Important note: Tool Call Confirmation is part of Spring AI 2.1's core project, with official release and support. However, the flow of "waiting for a human across multiple Agents" is in the Spring AI Agent roadmap, not part of 2.1's core capabilities. If you need confirmation flow in multi-agent scenarios, wait for a later version or orchestrate it yourself at a higher layer.

1.3 Underlying mechanics: what happens during the pause

Mermaid flowchart: user question

Core difference: In the normal flow, ToolCallingManager directly executes the model's reply. In the confirmation flow, it first checks each call's requiresConfirmation flag, and if any call needs confirmation, the whole loop pauses and hands the decision to the application.

2. Message Parts: preserving the "reasoning process" without loss

2.1 The old problem: messages as "text + attached lists"

Before 2.1, Spring AI's AssistantMessage was structured as a text field plus a few separate lists: toolCalls, media.

It couldn't express the true interleaved order of "reasoning → tool call → text".

Why does that matter?

Because today's models (especially Anthropic, Google Gemini, DeepSeek's reasoning models) interleave reasoning and tool calls in their output.

If you scramble the order, or lose reasoning content during replay, the model might error out or its reasoning quality degrades.

Take Anthropic as an example: in tool-use rounds, Claude requires its thinking blocks to be returned as-is; you can't reorder, edit, or partially drop them.

Modified blocks are rejected with HTTP 400.

Before 2.1, Spring AI rebuilt tool rounds as "text → thinking → tool" regardless of the order Claude actually used.

2.2 2.1's approach: ordered MessagePart list

2.1 changes message content to an ordered MessagePart list.

Each Part is an independent segment:

Part type Content
TextPart Text
ReasoningPart Reasoning process (can carry OpaquePayload like Anthropic's thinking signature)
ToolCallPart Tool call
ToolResultPart Tool result
MediaPart Image/audio/PDF
UnknownPart Unknown block (preserves raw JSON, doesn't silently drop it)

Parts maintain the original order the model produced, so a round-trip can be faithfully replayed.

getText(), getMedia(), getToolCalls(), getReasoning() are now views over Parts; the old constructors and Builder still exist.

UserMessage question = UserMessage.builder()
    .part(TextPart.of("What's the difference between these two charts?"))
    .part(MediaPart.of(firstChart))
    .part(MediaPart.of(secondChart))
    .build();

AssistantMessage answer = chatModel.call(new Prompt(question)).getResult().getOutput();
for (ReasoningPart reasoning : answer.getReasoning()) {
    System.out.println("Reasoning: " + reasoning.text());
}
System.out.println(answer.getText());

An important version difference: Message Parts were introduced in 2.1.0-M1, but in M1 only OpenAiResponsesChatModel natively produced and consumed Parts. The other ChatModel implementations (Ollama, Anthropic, OpenAI Chat Completions, etc.) were refactored to use Parts only in RC1. If you use models with non-Responses endpoints, the full replay capability of Parts depends on versions after RC1.

2.3 Underlying mechanics

Mermaid flowchart: toolCalls

Different models have different replay requirements: Anthropic requires thinking blocks with signatures to be returned in order; Google GenAI requires each thought signature to return to the exact Part it came from, otherwise Gemini 3+ function calls return 400; OpenAI Responses requires reasoning items to be replayed with encrypted encrypted_content.

Parts design smooths these differences at the framework layer, so you don't need to write a replay logic for each model.

3. OpenAI Responses API

3.1 Why a new endpoint is needed

Spring AI originally used OpenAI's Chat Completions endpoint (/v1/chat/completions). This endpoint is fine for ordinary conversations, but starting from GPT-5.4, it doesn't support the combination of "tool calls + non-none reasoning effort".

If you're building an Agent and want the model to do deep reasoning before calling tools (setting reasoning effort to high or medium), Chat Completions will reject it.

Responses API (/v1/responses) solves this.

It natively supports the combination of tool calls and reasoning, and reasoning content can be preserved across tool-call rounds via encrypted reasoning items.

3.2 How to switch

Only need to change one property:

spring.ai.openai.chat.api=responses

All other connection config (api-key, base-url, model) stays the same. OpenAiResponsesChatModel is enabled automatically.

Key design: OpenAiResponsesChatModel is stateless. Each call sends the full Prompt, so ChatMemory, Advisors, RAG all work the same as with OpenAiChatModel. It doesn't rely on OpenAI server-side conversation storage; all state is on the client side.

Note: The two OpenAI endpoints (Chat Completions and Responses) are mutually exclusive; by default only one is configured. If you actually want to use both, say, use Chat Completions for cheap classification and Responses for Agent, you need to explicitly declare the second with a Builder.

4. Decision Model

4.1 What problem it solves

Some scenarios don't need the large model to "generate a paragraph"; they need it to make a judgment: is this review positive or negative? Does this code have security risk? Is this document relevant to the query?

Using ChatModel for this works, but cost and latency are not worth it. ChatModel's strength is generation, not classification.

4.2 2.1's approach: a dedicated DecisionModel

2.1 introduces the DecisionModel interface in RC2, specialized for "judgment with probabilities". It supports three answer types: Choice (choose from options), Noul (yes/no probability), Score (rate on a scale).

// Determine if a ticket needs escalation
DecisionResponse response = decisionModel.evaluate(
    "Customer says 'I was double-charged, please handle quickly'",
    DecisionRequest.builder()
        .choice("category", "ticket category", 
                "billing", "technical", "other")
        .noul("is_urgent", "is urgent")
        .build()
);

// Make decision based on probability
if (response.getNoul("is_urgent").isYes(0.9)) {
    escalateToHuman();
}

Three implementations:

4.3 Underlying mechanics

Mermaid flowchart: input prompt

Core difference: ChatModel returns text, and you have to parse and judge it yourself. DecisionModel returns calibrated probabilities, and your code can directly use predicates like isYes(0.9) to decide whether to trigger an action.

Note: DecisionModel is still a machine learning model, not a rules engine. Its answers are not deterministic, and probabilities are not absolute. You need to set your own thresholds and accept a certain rate of misjudgment. Official docs specifically discuss how to think about thresholds and wrong answers.

5. Other notable changes

5.1 Streaming tool call parameters

When a model streams tool calls, parameters come in chunks.

Before 2.1, Spring AI only exposed the complete call.

2.1 also streams the parameter increments, so a UI can display the tool call while the model is still "writing" the parameters.

ToolCallParts with a partial marker are ignored by getToolCalls() and ToolCallingManager; the complete call still follows at the same index.

5.2 More vector stores support custom Embedding

M1 introduced VectorStore.upsert() to write your own computed vectors, RC1 added similaritySearch(float[], SearchRequest) to search with your own query vectors.

RC2 extended both capabilities to Neo4j, MongoDB Atlas, Typesense, MariaDB, Chroma, and more vector stores.

5.3 Session API evolution

ChatMemory and related types are marked deprecated in 2.1; they need to be migrated to the Session API. The Session API provides Turn concept (a UserMessage plus all subsequent events) and composable compaction triggers and strategies (sliding window, window by Turn, token count, recursive summarization).

SessionMemoryAdvisor can transparently integrate with ChatClient, and the conversation_search tool supports keyword search over compacted history.

But note: The Session API's official docs currently have no multi-agent section; community docs need to adapt themselves. Cross-agent confirmation flow is in the Spring AI Agent roadmap.

6. Pros and cons

Pros

1. Tool call confirmation gives high-risk operations a gate
Framework-level pause/resume, no app-layer hacks. Correctly restores after service restart and multi-instance deployment.

2. Message Parts preserve reasoning
Ordered Part list faithfully reproduces the interleaved order from the model. Anthropic, Gemini, DeepSeek reasoning replay requirements are met.

3. OpenAI Responses API
The correct endpoint for Agent scenarios, supporting tool calls + reasoning effort combination.

4. DecisionModel for classification
Probability is a first-class citizen; code makes decisions directly on probabilities, no text parsing needed.

5. Streaming tool parameters
UI can display tool calls while the model is writing parameters, better experience.

Cons

1. Migration cost
ChatMemory and related types are deprecated in 2.1, requiring migration to Session API. Message Parts means custom Message handling logic may need adjustments.

2. Parts' full support has version differences
M1 only OpenAiResponsesChatModel natively produces/consumes Parts; other models refactored in RC1. If you use non-OpenAI models, full Parts capability depends on versions after RC1.

3. DecisionModel needs extra config
System One's SystemOneDecisionModel is not auto-configured; need manual TypeSafeClient.

4. Multi-agent scenarios still on the way
Cross-agent human wait flows are in Spring AI Agent's roadmap, not in 2.1 core.

7. Applicable scenarios

Scenario Recommendation Reason
Enterprise Agent, high-risk tools need human confirmation ✅✅✅ Strongly recommend Tool Call Confirmation is a must-have
Need full replay of model reasoning ✅✅✅ Strongly recommend Message Parts preserve order and signatures
Use OpenAI flagship model for Agent ✅✅✅ Strongly recommend Responses API is the correct endpoint
Ticket classification/risk judgment/relevance scoring ✅✅✅ Strongly recommend DecisionModel is better than ChatModel
Need streaming display of tool call parameters ✅✅ Recommended Parameter increments streamed
Heavy user of existing ChatMemory ⚠️ Needs evaluation Need to migrate to Session API
Multi-agent scenarios requiring human flow ⚠️ Needs evaluation Wait for later Spring AI Agent versions

More project practice at Java Commando website: susan.net.cn/project

8. Final thoughts

Back to the original question: Is Spring AI 2.1 worth upgrading?

My judgment: If your Agent is going to do real stuff, yes.

2.1 doesn't solve "whether you can call the model", it solves "what to do when the model calls incorrectly". Tool Call Confirmation turns human confirmation into a framework capability, Message Parts stops reasoning from being lost, Responses API gives Agent the right endpoint, DecisionModel gives classification a dedicated tool.

These capabilities stack up and point in one direction: Spring AI is moving from an "AI integration layer" to an "Agent runtime". 2.0 solved "how to call", 2.1 begins to solve "how to call steadily, correctly, and controllably".

Of course, 2.1 has its costs.

ChatMemory deprecation requires migration, Parts' full support has version differences between M1 and RC1, DecisionModel needs extra config, multi-agent confirmation flow is still in planning.

But for teams pushing Agents to production, these hurdles buy real peace of mind.

Reference resources: