Skip to content

feat(subagent): support passing user-defined fields in SubAgentTool#1259

Open
jujn wants to merge 6 commits into
agentscope-ai:mainfrom
jujn:feat_485
Open

feat(subagent): support passing user-defined fields in SubAgentTool#1259
jujn wants to merge 6 commits into
agentscope-ai:mainfrom
jujn:feat_485

Conversation

@jujn

@jujn jujn commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

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.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@jujn jujn requested review from a team and Copilot April 20, 2026 08:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SubAgentConfig to declare custom parameters (simple types or full JSON Schema) and required custom fields.
  • Update SubAgentTool to include custom parameters in the generated schema and to forward non-built-in inputs into the sub-agent message metadata.
  • 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.

Comment thread agentscope-core/src/main/java/io/agentscope/core/tool/subagent/SubAgentTool.java Outdated
Comment thread agentscope-core/src/main/java/io/agentscope/core/tool/subagent/SubAgentTool.java Outdated
Comment thread docs/en/multi-agent/subagent.md Outdated
Comment thread docs/zh/multi-agent/subagent.md Outdated
@codecov

codecov Bot commented Apr 20, 2026

Copy link
Copy Markdown

@LearningGp

Copy link
Copy Markdown
Member
image

Comment thread agentscope-core/src/main/java/io/agentscope/core/tool/subagent/SubAgentTool.java Outdated

@LearningGp LearningGp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AgentScopeJavaBot AgentScopeJavaBot added enhancement New feature or request area/core/tool Tool, skill, RAG abstractions labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core/tool Tool, skill, RAG abstractions enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support passing user-defined fields in SubAgentTool

4 participants