feat(subagent): support passing user-defined fields in SubAgentTool#1259
Open
jujn wants to merge 6 commits into
Open
feat(subagent): support passing user-defined fields in SubAgentTool#1259jujn wants to merge 6 commits into
jujn wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for passing user-defined fields to sub-agents by extending SubAgentTool’s JSON schema and attaching extra tool-call inputs as Msg.metadata, with corresponding docs and tests.
Changes:
- Extend
SubAgentConfigto declare custom parameters (simple types or full JSON Schema) and required custom fields. - Update
SubAgentToolto include custom parameters in the generated schema and to forward non-built-in inputs into the sub-agent messagemetadata. - Add documentation (EN/ZH) and unit tests covering schema generation and metadata injection behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/zh/multi-agent/subagent.md | Documents passing custom context/parameters to sub-agents via metadata. |
| docs/en/multi-agent/subagent.md | English version of the new custom context/parameter documentation. |
| agentscope-core/src/main/java/io/agentscope/core/tool/subagent/SubAgentTool.java | Builds schema with custom params; forwards extra inputs into Msg.metadata. |
| agentscope-core/src/main/java/io/agentscope/core/tool/subagent/SubAgentConfig.java | Adds custom parameter declarations + required list to configuration/builder. |
| agentscope-core/src/test/java/io/agentscope/core/tool/subagent/SubAgentToolTest.java | Adds tests for schema containing custom params and metadata injection. |
| agentscope-core/src/test/java/io/agentscope/core/tool/subagent/SubAgentConfigTest.java | Adds tests for custom parameter builder behavior and empty defaults. |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Member
LearningGp
requested changes
May 21, 2026
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.

Description
Close #485
This PR introduces a mechanism to pass user-defined external parameters (e.g.,
userId,tenantId) to sub-agents securely, addressing the issue where parameters could only be passed via the pure text message.Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)