Skip to content

feat(subagent): enhance event forwarding with rich metadata#529

Merged
chickenlj merged 5 commits intoagentscope-ai:mainfrom
AlbumenJ:0113-subagent
Jan 13, 2026
Merged

feat(subagent): enhance event forwarding with rich metadata#529
chickenlj merged 5 commits intoagentscope-ai:mainfrom
AlbumenJ:0113-subagent

Conversation

@AlbumenJ
Copy link
Collaborator

Change-Id: Iae897d08d190ef1fdf65e8e16a8d6cb29da818f1

AgentScope-Java Version

[The version of AgentScope-Java you are working on, e.g. 1.0.6, check your pom.xml dependency version or run mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]

Description

[Please describe the background, purpose, changes made, and how to test this PR]

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

Change-Id: Iae897d08d190ef1fdf65e8e16a8d6cb29da818f1
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the SubAgentTool's event forwarding mechanism by adding rich metadata to forwarded events. The changes enable parent agents to identify which sub-agent generated an event and track the session context, improving observability and debugging capabilities.

Changes:

  • Modified forwardEvent method to include metadata map with sub-agent information (name, ID, session ID, and original event)
  • Added Jackson annotations to Event class for proper JSON serialization/deserialization support
  • Replaced unused StreamOptions parameter with relevant Agent and sessionId parameters

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
agentscope-core/src/main/java/io/agentscope/core/tool/subagent/SubAgentTool.java Enhanced forwardEvent method to create ToolResultBlock with metadata map containing sub-agent context
agentscope-core/src/main/java/io/agentscope/core/agent/Event.java Added @JsonCreator, @JsonProperty, and @JsonIgnoreProperties annotations to support JSON serialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…/SubAgentTool.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...io/agentscope/core/tool/subagent/SubAgentTool.java 50.00% 0 Missing and 4 partials ⚠️
...agentscope/core/agui/adapter/AguiAgentAdapter.java 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Change-Id: Id03e810eb0f8e91f9f5e545f572f5ba8ed098375
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@chickenlj chickenlj merged commit 69b2fc9 into agentscope-ai:main Jan 13, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants