[ 
https://issues.apache.org/jira/browse/CAMEL-27244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Federico Mariani updated CAMEL-27244:
-------------------------------------
    Component/s:     (was: camel-ai)
    Description: 
Spring AI 2.1.0 can pause the tool-calling loop before a tool runs ("tool call 
confirmation"). When the model calls a tool marked {{requiresConfirmation}}, no 
call of that reply runs, and the reply goes back to the application with the 
calls that wait for a decision. The application collects one 
{{ToolCallDecision}} per call (allow, or deny with a message), runs them with 
{{ToolCallingManager.executeToolCalls(prompt, reply, decisions)}} and sends the 
results to the model. The loop keeps nothing while it waits, so the decision 
can come much later and from another instance.

For Camel this is a human-in-the-loop step before a tool that changes things 
(book, delete, pay): the approval can come from any route, such as a mail, a 
chat message, a REST call or a task list.

h3. Proposal

* A spring-ai-chat endpoint option naming the tools that need confirmation. It 
covers ai-tool routes, tool callbacks and MCP tools. The confirmation belongs 
to that endpoint: the same tool used by another endpoint or component runs as 
before.
* When the loop pauses, the exchange ends with the pending calls (id, name, 
arguments) in a header, and a header that tells the reply waits for a decision.
* Resume: a request with the same conversation id carries the decisions in a 
header. The allowed calls run, the denied ones answer the model with their 
message, and the loop continues.
* The paused reply is read from the conversation memory, never from the 
request: session memory (CAMEL-27243) and chat memory. Spring AI's JDBC chat 
memory repository does not store tool calls, so session memory is the one for 
production.
* A new message instead of a decision closes the pause: its calls are denied 
and do not run.

Not in ai-tool for now: only spring-ai-chat can pause, so camel-openai, 
camel-langchain4j-agent and camel-mcp-server are unchanged.

_Claude Code on behalf of Croway_

  was:
Spring AI 2.1.0 can pause the tool-calling loop before a tool runs ("tool call 
confirmation"). When the model calls a tool marked {{requiresConfirmation}}, or 
one chosen by a {{ToolCallConfirmationPolicy}} (for example by name, for MCP 
tools), no call of that reply runs. The reply goes back to the application with 
the calls that wait for a decision. The application collects one 
{{ToolCallDecision}} per call (allow, or deny with a message), runs them with 
{{ToolCallingManager.executeToolCalls(prompt, reply, decisions)}} and sends the 
results to the model. The loop keeps nothing while it waits, so the decision 
can come much later and from another instance.

For Camel this is a human-in-the-loop step for ai-tool routes that change 
things (book, delete, pay): the approval can come from any route, such as a 
mail, a chat message, a REST call or a task list.

h3. Proposal, to refine

* A way to mark the tools that need confirmation: an ai-tool route option, and 
an endpoint option naming tools (which also covers MCP tools).
* spring-ai-chat: when the loop pauses, the exchange ends with the pending 
calls (id, name, arguments) in a header, and a header that tells the reply 
waits for a decision. The conversation is kept by the session memory, the chat 
memory, or the caller.
* Resume: a request that carries the decisions runs the allowed calls, answers 
the denied ones with their message, and continues the loop.
* openai and langchain4j-agent do not support it: a tool that needs 
confirmation must fail there instead of running without one.

_Claude Code on behalf of Croway_

        Summary: camel-spring-ai-chat - ask a person to confirm a tool call 
before it runs  (was: camel-spring-ai-chat - ask a person to confirm a tool 
call before an ai-tool route runs)

> camel-spring-ai-chat - ask a person to confirm a tool call before it runs
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-27244
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27244
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-spring-ai
>            Reporter: Federico Mariani
>            Assignee: Federico Mariani
>            Priority: Major
>
> Spring AI 2.1.0 can pause the tool-calling loop before a tool runs ("tool 
> call confirmation"). When the model calls a tool marked 
> {{requiresConfirmation}}, no call of that reply runs, and the reply goes back 
> to the application with the calls that wait for a decision. The application 
> collects one {{ToolCallDecision}} per call (allow, or deny with a message), 
> runs them with {{ToolCallingManager.executeToolCalls(prompt, reply, 
> decisions)}} and sends the results to the model. The loop keeps nothing while 
> it waits, so the decision can come much later and from another instance.
> For Camel this is a human-in-the-loop step before a tool that changes things 
> (book, delete, pay): the approval can come from any route, such as a mail, a 
> chat message, a REST call or a task list.
> h3. Proposal
> * A spring-ai-chat endpoint option naming the tools that need confirmation. 
> It covers ai-tool routes, tool callbacks and MCP tools. The confirmation 
> belongs to that endpoint: the same tool used by another endpoint or component 
> runs as before.
> * When the loop pauses, the exchange ends with the pending calls (id, name, 
> arguments) in a header, and a header that tells the reply waits for a 
> decision.
> * Resume: a request with the same conversation id carries the decisions in a 
> header. The allowed calls run, the denied ones answer the model with their 
> message, and the loop continues.
> * The paused reply is read from the conversation memory, never from the 
> request: session memory (CAMEL-27243) and chat memory. Spring AI's JDBC chat 
> memory repository does not store tool calls, so session memory is the one for 
> production.
> * A new message instead of a decision closes the pause: its calls are denied 
> and do not run.
> Not in ai-tool for now: only spring-ai-chat can pause, so camel-openai, 
> camel-langchain4j-agent and camel-mcp-server are unchanged.
> _Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to