Skip to content

feat(core): propagate ToolResultBlock metadata through agent events and AG-UI protocol#2315

Open
ningmeng0503 wants to merge 2 commits into
agentscope-ai:mainfrom
ningmeng0503:feat/propagate-toolresult-metadata
Open

feat(core): propagate ToolResultBlock metadata through agent events and AG-UI protocol#2315
ningmeng0503 wants to merge 2 commits into
agentscope-ai:mainfrom
ningmeng0503:feat/propagate-toolresult-metadata

Conversation

@ningmeng0503

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.0.1-SNAPSHOT

Description

Tools may return structured execution context via ToolResultBlock.metadata, but this metadata is currently dropped when converting tool results into events. This
PR propagates ToolResultBlock.getMetadata() end-to-end through the v2 agent event stream and the AG-UI protocol so consumers can access tool-specific context.

Changes made

  • Core events (agentscope-core):

    • Added metadata support to ToolResultStartEvent, ToolResultTextDeltaEvent, ToolResultDataDeltaEvent, and ToolResultEndEvent.
    • Added backward-compatible constructors that delegate to the new @JsonCreator constructors with metadata = null.
    • Updated ReActAgent.runToolBatch to copy ToolResultBlock.metadata into delta and end events.
  • AG-UI protocol (agentscope-extensions-agui):

    • Extended AguiEvent.ToolCallResult with a nullable metadata field.
    • Updated AguiAgentAdapter.convertEvent to populate ToolCallResult metadata from ToolResultBlock.

Checklist

  • 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

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

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.

1 participant