ShellExecuteTool
public class ShellExecuteTool
源码Source
io/agentscope/harness/agent/tool/ShellExecuteTool.java:27–99Shell 执行工具,封装可被智能体调用的能力。位于 io.agentscope.harness.agent.tool 包。核心成员包括 execute、ShellExecuteTool、NAME。
Shell execution tool backed by a AbstractSandboxFilesystem.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
NAMEstaticfinal | 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 |
|---|---|---|
sandbox | AbstractSandboxFilesystem | 沙箱(类型 `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 |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。per-call agent runtime injected by the framework (not an LLM argument); may be `null` when no merged context is available |
command | String | 命令(类型 `String`)。The command. |
workingDirectory | String | working 目录(类型 `String`)。The working directory. |
timeout | Integer | 超时时间(类型 `Integer`)。The timeout. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/harness/agent/tool/ShellExecuteTool.java:44–90