fix(spring-ai): make tool execution configurable - #1472
Open
mumu-1029521 wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
hemasekhar-p
force-pushed
the
codex/fix-spring-ai-tool-context
branch
from
August 31, 2026 11:36
b13d3cc to
a35726e
Compare
Contributor
|
Hi @mumu-1029521, thank you for your contribution! We appreciate you taking the time to submit this pull request. Currently this PR is under review by our team we will keep you posted if any additional information is required. thank you. |
mumu-1029521
force-pushed
the
codex/fix-spring-ai-tool-context
branch
from
September 1, 2026 03:19
a35726e to
aa74564
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
ToolConverterexecuted converted ADK tools from a Spring AI callback withtool.runAsync(processedArguments, null). Any tool that uses ADK'sToolContextcould therefore fail with aNullPointerException. Making all tool calls definition-only avoids that null but makes execution ownership one-size-fits-all.Solution:
Make tool execution ownership explicit and configurable:
ADK_MANAGEDis the default. Spring AI receives definition-only callbacks and returns tool calls to ADK. ADK executes them with its normal invocation-derivedToolContext, callbacks, confirmation, and state lifecycle.SPRING_AI_MANAGEDis opt-in. The wrapper drives Spring AI'sToolCallingManagerloop for blocking and streaming requests.AdkToolContextResolver. Construction or Spring Boot startup fails fast when the resolver is missing, and execution fails if it returnsnull; no hard-coded null context remains.ADK_MANAGED.Spring Boot users can select the owner with:
adk.spring-ai.tool-execution.mode=SPRING_AI_MANAGEDand provide an
AdkToolContextResolverbean. The default isADK_MANAGED, so existing applications keep ADK lifecycle semantics without configuration. Spring-AI-managed streaming buffers each model turn before executing requested tools and emitting the final turn.Testing Plan
Unit Tests:
Coverage includes:
ToolContext.ToolResponseMessageto the next model turn.Runnerintegration flow verifies that ADK executes the requested tool exactly once with a non-null invocation-derivedToolContext, then returns the final model response.Manual End-to-End (E2E) Tests:
The in-memory ADK
Runnerintegration test exercises the complete model tool-call → ADK tool execution → tool-response → final model-response flow. A live external-provider E2E test was not run because it requires provider credentials.Checklist
Additional context
No downstream dependency changes are required. This supersedes the one-size-fits-all execution approach in the previous revision while preserving the later
ToolResponseMessageand mixed text/function-response fixes already present onmain.