feat(harness): support passing business context from InboundMessage to RuntimeContext (#1966)#1967
Open
Buktal wants to merge 2 commits into
Open
feat(harness): support passing business context from InboundMessage to RuntimeContext (#1966)#1967Buktal wants to merge 2 commits into
Buktal wants to merge 2 commits into
Conversation
…o RuntimeContext Add Map<String, Object> businessContext field to InboundMessage, propagate it through MsgContext and RouteResult, and inject it into RuntimeContext.Builder via HarnessGateway so middlewares and tools can access caller-provided business parameters (e.g. tenantId, modelConfigId, datasourceId). - InboundMessage: new businessContext field + Builder.putBusinessParam() - MsgContext: new businessContext field (not in canonicalKey()) - RouteResult: unchanged (businessContext accessible via .context()) - HarnessGateway: injectBusinessContext() in both run() and runStream() Co-authored-by: 江宝坤 <jiangbaokun@kst.software>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
AgentScope-Java Version
2.0.0-SNAPSHOT
Related Issue
Closes #1966
Description
Add
Map<String, Object> businessContexttoInboundMessageto allow callers to passbusiness parameters (e.g. tenantId, modelConfigId, datasourceId) through the channel/gateway
pipeline into
RuntimeContext, eliminating the need for ConcurrentHashMap workarounds withmanual lifecycle management.
Key design decisions:
businessContextdoes NOT participate incanonicalKey()— session routing is unaffectedMsgContext.extra(which affects session routing)Map<String, Object>provides flexibility for simple types; Javadoc recommends simple types.businessContext(Map)and.putBusinessParam(key, value)for convenienceData flow:
Changes:
InboundMessage: newbusinessContextfield + Builder methodsMsgContext: newbusinessContextfield +withBusinessContext(), NOT incanonicalKey()ChannelRouter: propagates businessContext from InboundMessage to MsgContextHarnessGateway:injectBusinessContext()inrun()andrunStream()Checklist
mvn spotless:applymvn test)