You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently using Spring AI to build a front-end and back-end integrated AI Agent system. One typical use case I need to implement is:
The user needs to confirm a tool call via the UI before it is executed by the backend.
I have already learned and used internalToolExecutionEnabled = false to prevent Spring from executing the tool call automatically, so that the tool execution can be manually triggered. However, I encountered the following difficulty in implementation:
ToolCallingManager#executeToolCalls(Prompt prompt, ChatResponse chatResponse)
requires a ChatResponse object to execute tools, which is difficult to persist across multiple interactions.
Specific Issue:
User initiates a conversation → receives a ChatResponse containing tool calls → tools are not executed automatically
The frontend renders the tool call information and waits for the user to click “Confirm Execution”
On the second request when the user confirms → it becomes very difficult to retrieve the original ChatResponse because:
Spring AI’s memory only stores Message objects and cannot reconstruct the full ChatResponse
If I cache the ChatResponse for future confirmation, it results in complicated state management, such as needing to persist “pending tool call state” when the user refreshes the page, closes it, or delays the confirmation
My Questions:
Is it recommended to store the ChatResponse in a database? This seems too heavy-weight since ChatResponse includes a lot of contextual information.
Is there a better way to enable the front-end and back-end to coordinate using a “lightweight reference” to restore the previous ToolCall context?
Is Spring AI planning to provide a “lightweight identifier-based caching or restoration mechanism” for ToolCalls? Something like structuring ToolCall (with parameters) into an encodable format, so that the follow-up request only needs to carry an ID or snippet?
Looking forward to suggestions from the community or maintainers. Thank you!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently using Spring AI to build a front-end and back-end integrated AI Agent system. One typical use case I need to implement is:
The user needs to confirm a tool call via the UI before it is executed by the backend.
I have already learned and used internalToolExecutionEnabled = false to prevent Spring from executing the tool call automatically, so that the tool execution can be manually triggered. However, I encountered the following difficulty in implementation:
ToolCallingManager#executeToolCalls(Prompt prompt, ChatResponse chatResponse)
requires a ChatResponse object to execute tools, which is difficult to persist across multiple interactions.
Specific Issue:
User initiates a conversation → receives a ChatResponse containing tool calls → tools are not executed automatically
The frontend renders the tool call information and waits for the user to click “Confirm Execution”
On the second request when the user confirms → it becomes very difficult to retrieve the original ChatResponse because:
Spring AI’s memory only stores Message objects and cannot reconstruct the full ChatResponse
If I cache the ChatResponse for future confirmation, it results in complicated state management, such as needing to persist “pending tool call state” when the user refreshes the page, closes it, or delays the confirmation
My Questions:
Is it recommended to store the ChatResponse in a database? This seems too heavy-weight since ChatResponse includes a lot of contextual information.
Is there a better way to enable the front-end and back-end to coordinate using a “lightweight reference” to restore the previous ToolCall context?
Is Spring AI planning to provide a “lightweight identifier-based caching or restoration mechanism” for ToolCalls? Something like structuring ToolCall (with parameters) into an encodable format, so that the follow-up request only needs to carry an ID or snippet?
Looking forward to suggestions from the community or maintainers. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions