Skip to content

[Bug]: tool_call_args is empty in ag protocol due to incomplete handling of streamed tool call arguments #498

Closed

Description

@yangxb2010000

AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.

Describe the bug
When using the ag protocol, the tool_call_args field returned by the server is always empty. This appears to be due to the fact that arguments (args) are streamed via multiple events, but the current implementation only captures args on the first tool-type event and ignores subsequent chunks. Additionally, the code does not handle streaming for events of type toolresult, although it's unclear whether toolresult is intended to support streaming at all.

To Reproduce
Steps to reproduce the behavior:

  1. Use the AgentScope-Java SDK with the ag protocol.
  2. Invoke an agent that triggers a tool call with streaming enabled (i.e., stream: true).
  3. Observe the received events containing tool type — only the first event’s args are captured; subsequent streaming chunks containing additional args data are ignored.
  4. If a toolresult event is streamed (if applicable), its payload is also not properly accumulated.

Expected behavior
The tool_call_args should be fully reconstructed by aggregating all streamed chunks for tool-type events. If toolresult supports streaming, its content should also be properly accumulated across events.

Error messages
No explicit exception is thrown, but the resulting tool_call_args is incomplete or empty despite the server sending incremental argument data via multiple events.

Environment (please complete the following information):

  • AgentScope-Java Version: [e.g., 1.0.6 — please check your pom.xml or run mvn dependency:tree | grep agentscope-parent:pom]
  • Java Version: [e.g., 17]
  • OS: [e.g., macOS, Windows, Linux]

Additional context
This issue likely stems from the event handling logic in the streaming response parser, which assumes tool arguments are delivered in a single event rather than incrementally. A robust implementation should buffer and concatenate args (and potentially toolresult content) across multiple streaming events until the tool interaction is complete.

Activity

  1. added
    bug
    on Jan 9, 2026
  2. changed the title [-][Bug]: ag-ui协议模式下输出的tool_call_args永远是空的,另外当event为toolresult类型时,也没有处理流式的场景(我不太确定是否有流式的场景)[/-] [+][Bug]: tool_call_args is empty in ag protocol due to incomplete handling of streamed tool call arguments[/+] on Jan 9, 2026
  3. yangxb2010000 commented on Jan 9, 2026

    @yangxb2010000
    ContributorAuthor

    In addition, the result of toolcall should be placed in the toolcallResult event, which is currently placed in the toolcallend event. reference resources: https://docs.ag-ui.com/concepts/events#toolcallchunk

  4. harmonyzhang commented on Jan 12, 2026

    @harmonyzhang
    Image

    Using agui to pass in frontend tools, not currently supported?

    After adding the registration logic and fixing the tool call arguments event problem, it works fine, but the agent doesn't handle anything when it asks again.

  5. moved this from Backlog to Done in AgentScope Javaon Apr 3, 2026
  6. closed this as completedby moving to Done in AgentScope Javaon Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions