agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Feature]: 多智能体协作文档处理问题

Open oyx888 opened this issue 3 months ago • 3 comments

多智能体处理文档时,session隔离状态下,读取不到用户上传到session目录下的文件,即使用url,subagent下载处理完毕,返回给父agent时也读不到,只能依靠提示词互相传文档url来解决这个问题,很麻烦,是否有更好的解决方法

oyx888 avatar Sep 02 '26 10:09 oyx888

Issue Evaluation

Category: enhancement | Status: Evaluated

With session isolation enabled, sub-agents cannot read files that the user uploaded into the parent session directory (and vice versa), even when a URL is passed; today the only workaround is shuttling document URLs between agents via prompts.

Feasibility: needs-discussion. The underlying question is how file/artifact visibility should be scoped across parent/sub-agent boundaries under session isolation — e.g. an explicit shared artifact store or a capability to grant a sub-agent read access to specific parent-session files. Scope: memory/session state and sub-agent orchestration (agentscope-core, harness workspace). Compatibility: any cross-session sharing must remain explicit and opt-in to preserve isolation guarantees.

Could you describe the exact topology (which agent uploads, which sub-agent needs the file, and how isolation is configured)? A concrete scenario will help narrow the design options.


Automated evaluation by github-manager-bot

oss-maintainer avatar Sep 03 '26 07:09 oss-maintainer

Issue Evaluation  问题评估

Category: enhancement | Status: Evaluated类别: enhancement | 状态: 已评估

With session isolation enabled, sub-agents cannot read files that the user uploaded into the parent session directory (and vice versa), even when a URL is passed; today the only workaround is shuttling document URLs between agents via prompts.在启用了会话隔离功能的情况下,子代理无法读取用户上传到父会话目录中的文件(反之亦然),即使传递了 URL 也是如此。目前唯一的解决办法就是通过提示来在代理之间传输文档的 URL。

Feasibility: needs-discussion. The underlying question is how file/artifact visibility should be scoped across parent/sub-agent boundaries under session isolation — e.g. an explicit shared artifact store or a capability to grant a sub-agent read access to specific parent-session files.可行性:需要进一步讨论。核心问题在于,在会话隔离的情况下,如何确定文件/工件的可见性应涵盖父代理与子代理之间的边界——例如,是否需要建立一个明确的共享工件存储机制,或者能否授予子代理对特定父会话文件的读取权限。 Scope: memory/session state and sub-agent orchestration (agentscope-core, harness workspace).范围:包括内存/会话状态以及子代理的协调工作(agentscope-core、harness 工作区)。 Compatibility: any cross-session sharing must remain explicit and opt-in to preserve isolation guarantees.兼容性:任何跨会话共享操作都必须是显式的,并且需要用户自愿参与,这样才能保证隔离性的保障。

Could you describe the exact topology (which agent uploads, which sub-agent needs the file, and how isolation is configured)? A concrete scenario will help narrow the design options.您可以描述一下具体的拓扑结构吗?也就是哪个代理负责上传文件,哪个子代理需要该文件,以及隔离配置是如何设置的?一个具体的场景将有助于缩小设计选项的范围。

Automated evaluation by github-manager-bot由 github-manager-bot 进行的自动化评估

首先用户聊天时,用户上传了文件,首先我们会把这个文件上传到文件服务上, 通过提示词拼接例: 帮我分析这份文档用户上传了附件url,需要先使用下载工具,如需要子智能体处理文档时发出指令应该是用户上传文件的完整url,处理完成的文档也需要要子智能体使用上传文件工具上传后返回完整的url:- http://127.0.0.1:9001/file/xxxxxxx agent配置HarnessAgent.builder().workspace("./workspace") 本地文件系统配置.isolationScope(IsolationScope.SESSION) 提示词不这样写,就会出现一直循环在找文件的过程中,导致循环耗尽直接停止

oyx888 avatar Sep 03 '26 14:09 oyx888

I think the solution should be an explicit artifact-sharing capability rather than making parent and child workspaces mutually visible. Session isolation should remain the default; the parent should grant a child a named, read-only artifact reference for a bounded lifetime.\n\nA small first contract could be:\n\n- Parent upload/download tools return an ArtifactRef (artifactId, immutable content digest, media type, size, owner session), not only a raw URL or filesystem path.\n- spawnAgent accepts an explicit sharedArtifacts set and mints per-child capabilities with operations (READ, optionally WRITE_DERIVATIVE), expiry, and a parent/child scope. No directory-wide inheritance.\n- Child tools resolve the capability through an artifact store; raw parent workspace paths remain inaccessible. A derived artifact is written under a new id and returned to the parent as a reference, so ownership/provenance is preserved.\n- Validation should happen at tool execution time, not only during spawning, to handle expired/revoked capabilities and prevent a child from forwarding an ambient path to an unrelated agent.\n\nImportant acceptance cases: an unshared parent artifact remains unreadable; one child can read exactly its granted artifact but not siblings; expiration/revocation fails safely; a child-created derivative is readable by the parent only after explicit return/grant; concurrent child reads do not mutate source bytes; traversal/symlink/URL redirects cannot escape the artifact authority.\n\nThis also removes the need to put long or local URLs in prompts: the model sees a stable artifact handle and uses a scoped tool. If maintainers agree with the boundary, I can help turn the contract into a small SPI/API proposal before implementation.

CryoThrust avatar Sep 05 '26 10:09 CryoThrust