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

[Bug]: Sandbox prompt references non-existent upload/download tools — agents lack an artifact delivery tool

Open chcodex opened this issue 3 months ago • 5 comments

Is your feature request related to a problem? Please describe.

In sandbox mode, WorkspaceContextMiddleware renders a ## Workspace paragraph that instructs the model to "use the upload/download tools to move files across the boundary" (WorkspaceContextMiddleware.java, sandbox branch). However, the harness exposes no upload/download AgentTool to the model at all:

  • FilesystemTool registers only read_file, write_file, edit_file, grep_files, glob_files, list_files.
  • File transfer into/out of the sandbox (SandboxFileTransfer, base64-via-exec) is an internal mechanism, invisible to the LLM.

So the instruction is a dead reference: the model is told to use tools that do not exist, and any artifact it produces inside the sandbox has no supported way to leave it.

Describe the solution you'd like

My view: the agent does not actually need a generic upload/download tool. What is missing is an artifact delivery tool — a first-class tool that takes a file produced in the sandbox workspace and explicitly delivers it to a destination outside the sandbox (e.g. the host, or a project's artifact store).

Concretely:

  • An SPI interface such as ArtifactDeliveryTarget (deliver(RuntimeContext, ArtifactDeliveryRequest) -> ArtifactDeliveryResult) so the framework stays business-agnostic and the destination logic (e.g. WebDAV upload) is implemented by the application.
  • A generic deliver_artifact tool in the harness (same style as FilesystemTool, @Tool-annotated), which downloads the file from the sandbox filesystem and delegates delivery to the configured target.
  • Update the sandbox branch of buildWorkspaceParagraph to reference the actual tool name instead of the non-existent "upload/download tools".

Additional context

Deployment scenario: a sandboxed agent that produces reports/documents and must hand them off to a project's artifact store (e.g. WebDAV). Currently there is no supported path for this.

chcodex avatar Aug 11 '26 07:08 chcodex

@chickenlj @jujn @LearningGp @Buktal @zouyx @guslegend0510 @RainYuY What do you think about this?

chcodex avatar Aug 11 '26 07:08 chcodex

我也遇到了,比如要沙箱里面,脚本已经生成的文件或者生成文档,需要智能体根据要求,能上传到对象OSS存储服务里

dargoner avatar Aug 11 '26 08:08 dargoner

我也遇到了,比如要沙箱里面,脚本已经生成的文件或者生成文档,需要智能体根据要求,能上传到对象OSS存储服务里

目前我的方案也是提供@Tool,由Agent上传到云存储

Buktal avatar Aug 11 '26 08:08 Buktal

我也遇到了,比如要沙箱里面,脚本已经生成的文件或者生成文档,需要智能体根据要求,能上传到对象OSS存储服务里

目前我的方案也是提供@tool,由Agent上传到云存储

没问题,但是框架层面必须与具体业务解耦

chcodex avatar Aug 11 '26 08:08 chcodex

@chickenlj @jujn @LearningGp @Buktal @zouyx @guslegend0510 @RainYuY @dargoner PR has been submitted

chcodex avatar Aug 11 '26 14:08 chcodex