AS AgentScopeAPI 手册 / API Reference

ArtifactDeliveryTool

public class ArtifactDeliveryTool
源码Source io/agentscope/harness/agent/tool/ArtifactDeliveryTool.java:37–186

Artifact Delivery 工具,封装可被智能体调用的能力。位于 io.agentscope.harness.agent.tool 包。核心成员包括 deliverArtifact、ArtifactDeliveryTool。

Agent-callable deliver_artifact tool: downloads a file from the agent filesystem (e.g. a sandbox workspace) and delegates the transport to a configured ArtifactDeliveryTarget.

This is the supported way for a sandboxed agent to hand an artifact it produced (report, document, image, archive) to a destination outside the sandbox. It is only registered when an ArtifactDeliveryTarget is configured on the builder.

构造器摘要Constructor Summary

构造器Constructor说明Description
public ArtifactDeliveryTool(AbstractFilesystem filesystem, ArtifactDeliveryTarget target)
初始化 `ArtifactDeliveryTool` 实例。
Creates a new instance.
public ArtifactDeliveryTool(AbstractFilesystem filesystem, WorkspacePathNormalizer pathNormalizer, ArtifactDeliveryTarget target)
初始化 `ArtifactDeliveryTool` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String deliverArtifact(RuntimeContext runtimeContext, String filePath, String fileName, String description, Boolean force)
执行 `deliverArtifact` 方法。
Performs the deliver artifact operation.

构造器详情Constructor Detail

ArtifactDeliveryTool

public ArtifactDeliveryTool(AbstractFilesystem filesystem, ArtifactDeliveryTarget target)

初始化 ArtifactDeliveryTool 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
targetArtifactDeliveryTarget目标(类型 `ArtifactDeliveryTarget`)。The target.
源码Source io/agentscope/harness/agent/tool/ArtifactDeliveryTool.java:43–45

ArtifactDeliveryTool

public ArtifactDeliveryTool(AbstractFilesystem filesystem, WorkspacePathNormalizer pathNormalizer, ArtifactDeliveryTarget target)

初始化 ArtifactDeliveryTool 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
pathNormalizerWorkspacePathNormalizer路径 Normalizer(类型 `WorkspacePathNormalizer`)。The path normalizer.
targetArtifactDeliveryTarget目标(类型 `ArtifactDeliveryTarget`)。The target.
源码Source io/agentscope/harness/agent/tool/ArtifactDeliveryTool.java:47–54

方法详情Method Detail

deliverArtifact

public String deliverArtifact(RuntimeContext runtimeContext, String filePath, String fileName, String description, Boolean force)

执行 deliverArtifact 方法。

Performs the deliver artifact operation.

参数Parameters
名称Name类型Type说明Description
runtimeContextRuntimeContext运行时上下文(类型 `RuntimeContext`)。per-call agent runtime injected by the framework (not an LLM argument); may be `null` when no merged context is available
filePathString文件路径(类型 `String`)。path of the generated file in the workspace, e.g. `outputs/report.docx`
fileNameString文件名称(类型 `String`)。target file name after delivery; defaults to the basename of `filePath`. Must be a plain file name: no path separators, `.` or `..`
descriptionString描述(类型 `String`)。short description of the artifact
forceBooleanforce(类型 `Boolean`)。if `false` (default) and a file with the same name already exists at the destination, delivery is rejected and the agent should retry with a new `fileName`; set to `true` to overwrite the existing artifact
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/tool/ArtifactDeliveryTool.java:71–165
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.