AS AgentScopeAPI 手册 / API Reference

ShellExecuteTool

public class ShellExecuteTool
源码Source io/agentscope/harness/agent/tool/ShellExecuteTool.java:27–99

Shell 执行工具,封装可被智能体调用的能力。位于 io.agentscope.harness.agent.tool 包。核心成员包括 execute、ShellExecuteTool、NAME。

Shell execution tool backed by a AbstractSandboxFilesystem.

字段摘要Field Summary

字段Field类型Type说明Description
NAME
staticfinal
String
名称字段。
Registered tool name (derived from the `#execute` method name).

构造器摘要Constructor Summary

构造器Constructor说明Description
public ShellExecuteTool(AbstractSandboxFilesystem sandbox)
初始化 `ShellExecuteTool` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String execute(RuntimeContext runtimeContext, String command, String workingDirectory, Integer timeout)
执行执行相关操作。
Performs the execute operation.

字段详情Field Detail

NAME

public static final String NAME
staticfinal

名称字段。声明为 public static final String NAME。

Registered tool name (derived from the #execute method name).

源码Source io/agentscope/harness/agent/tool/ShellExecuteTool.java:32

构造器详情Constructor Detail

ShellExecuteTool

public ShellExecuteTool(AbstractSandboxFilesystem sandbox)

初始化 ShellExecuteTool 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
sandboxAbstractSandboxFilesystem沙箱(类型 `AbstractSandboxFilesystem`)。The sandbox.
源码Source io/agentscope/harness/agent/tool/ShellExecuteTool.java:36–38

方法详情Method Detail

execute

public String execute(RuntimeContext runtimeContext, String command, String workingDirectory, Integer timeout)

执行执行相关操作。

Performs the execute 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
commandString命令(类型 `String`)。The command.
workingDirectoryStringworking 目录(类型 `String`)。The working directory.
timeoutInteger超时时间(类型 `Integer`)。The timeout.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/tool/ShellExecuteTool.java:44–90
基于官方固定版本源码静态生成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.