Skip to content

开启工具权限校验后,前端agui使用agent.subscribe监听不到agentscope-java2.0版本返回的RAW事件和RUN_FINISHED事件 #2721

Description

@liyy653787585

背景:
后端使用agentscope-java2.0基于权限系统开启了工具二次确认功能,合并fix(agui): emit AG-UI interrupt for permission-type HITL tool confirmation (#2437) (#2495 分支兼容了agui,并基于postman验证agui方式的后端返回ask询问、工具恢复执行环节均正常。

问题现象:
1、通过postman测试和前端F12均可以正常接收到后端返回的RAW和RUN_FINISHED事件。
2、但是前端基于@ag-ui/client的agent.subscribe方法无法监听到RAW和RUN_FINISHED事件,感觉是被拦截或过滤掉了。

agui后端返回的ask询问事件流如下:
{"type":"RAW","threadId":"thread-1786789346143","runId":"run-1786789352419","event":{"id":"d5c9b3bb214b427a8597a140e52af87b","createdAt":"2026-08-15T10:22:36.322430215Z","reason":"permission asking","generateReason":"PERMISSION_ASKING","type":"REQUEST_STOP"}}

{"type":"RUN_FINISHED","threadId":"thread-1786789346143","runId":"run-1786789352419","outcome":{"type":"interrupt","interrupts":[{"id":"2a1294d3e4474e0480f1527abb912bd0:chatcmpl-tool-b23237ff59b63f44","reason":"tool_call","message":"Tool 'delete' requires user confirmation before execution","toolCallId":"chatcmpl-tool-b23237ff59b63f44","responseSchema":{"required":["approved"],"type":"object","properties":{"approved":{"type":"boolean"},"editedArgs":{"description":"Full replacement of the tool args. Not merged.","type":"object"}}},"expiresAt":null,"metadata":{"toolContent":"{"modelName": "connector", "name": "chqtest"}","agentscope.interruptKind":"permission_confirm","toolName":"delete","replyId":"2a1294d3e4474e0480f1527abb912bd0","toolInput":{"name":"chqtest","modelName":"connector"}}}]}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ext/integrationExternal protocols & middleware integrationsbugSomething isn't working

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions