feat(agui): support custom RuntimeContext in AguiAgentAdapter#2101
Open
ningmeng0503 wants to merge 1 commit into
Open
feat(agui): support custom RuntimeContext in AguiAgentAdapter#2101ningmeng0503 wants to merge 1 commit into
ningmeng0503 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Add run(RunAgentInput, RuntimeContext) overload to AguiAgentAdapter; passing null falls back to the default context built from the input. - Change AguiAgentAdapter.buildRuntimeContext from private to protected so subclasses can customize the default runtime context. - Add process(RunAgentInput, String, String, RuntimeContext) overload to AguiRequestProcessor so callers can pass a custom context through the request processor; passing null falls back to the adapter default. - Keep the original run/process methods unchanged for backward compatibility.
660b312 to
eaa54e8
Compare
oss-maintainer
approved these changes
Jul 10, 2026
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
Summary
Clean feature addition — allows callers to inject a custom RuntimeContext into AguiAgentAdapter and AguiRequestProcessor, with proper null-fallback and backward compatibility.
Findings
- [Info]
AguiAgentAdapter.java:104— The null-check + fallback pattern is correct and consistent. - [Info]
AguiRequestProcessor.java:99— Good that the original 3-arg method is preserved as a delegate. - [Info] Tests cover all three paths (custom context, null fallback, subclass override) — well done.
Verdict
Straightforward, well-tested, fully backward compatible. LGTM.
Automated review by github-manager
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.
Summary
Allow callers to provide a custom
RuntimeContextwhen running an agent throughAguiAgentAdapterandAguiRequestProcessor, and let subclasses override the default context construction.Problem
AguiAgentAdapter.run(RunAgentInput)always built theRuntimeContextinternally, so callers could not:buildRuntimeContextwasprivate.More importantly, because the adapter owned the context instance, any custom data written by downstream middleware or tools during the run was invisible to the upstream caller. The caller had no way
to read that data back or use it to customize post-run processing.
AguiRequestProcessorhad the same limitation: it only exposedprocess(RunAgentInput, String, String), so AG-UI request handlers could not inject a pre-built context either.Changes
AguiAgentAdapter.run(RunAgentInput input, RuntimeContext runtimeContext).buildRuntimeContext(input).AguiAgentAdapter.buildRuntimeContextfromprivatetoprotectedfor subclass overrides.AguiRequestProcessor.process(RunAgentInput, String, String, RuntimeContext).nullpreserves the original behavior.run(RunAgentInput)andprocess(RunAgentInput, String, String)methods unchanged for backward compatibility.