AS AgentScopeAPI 手册 / API Reference

ShellPathPolicy

public final class ShellPathPolicy
源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:38–162

Shell 路径策略,让智能体以受控方式调用外部能力。位于 io.agentscope.harness.agent.skill.runtime 包。核心成员包括 noShell、sandbox、localWithShell、mode、resolve、SANDBOX_WORKSPACE_PREFIX。

Resolves the absolute filesRoot path emitted in <available_skills> and load_skill_through_path responses, given a skill's StageResult and the current shell mode.

Three modes the policy knows about:

  • Mode#NO_SHELL — no ShellExecuteTool registered. Returns null for every skill so the prompt omits <files-root> and the code-execution instruction block entirely.

  • Mode#SANDBOX — sandbox-backed filesystem. Paths use the sandbox-internal prefix (/workspace/).

  • Mode#LOCAL_WITH_SHELL — LocalFilesystemWithShell. Paths use the absolute host workspace root.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Mode枚举enum
定义模式相关取值的枚举。
A enum in io.agentscope.harness.agent.skill.runtime that defines enum values used when components lets agents invoke external capabilities under control.

字段摘要Field Summary

字段Field类型Type说明Description
SANDBOX_WORKSPACE_PREFIX
staticfinal
String
沙箱工作区 PREFIX字段。
The SANDBOX WORKSPACE PREFIX field.

方法摘要Method Summary

方法Method说明Description
public static ShellPathPolicy noShell()
static
返回 `noShell` 结果。
No shell is available; every `filesRoot` resolves to `null`.
public static ShellPathPolicy sandbox()
static
返回沙箱。
Sandbox mode — paths under the default `/workspace/` prefix.
public static ShellPathPolicy sandbox(String workspacePrefix)
static
设置沙箱。
Sandbox mode with a custom workspace prefix.
public static ShellPathPolicy localWithShell(Path workspaceRoot)
static
设置该参数。
Local-with-shell mode — paths absolute on the host.
public Mode mode()
返回模式。
Returns the mode.
public String resolve(String skillName, StageResult stage)
执行解析相关操作。
Returns the absolute `filesRoot` for the given skill, or `null` when shell is unavailable / the skill has no shell-reachable representation.

字段详情Field Detail

SANDBOX_WORKSPACE_PREFIX

public static final String SANDBOX_WORKSPACE_PREFIX
staticfinal

沙箱工作区 PREFIX字段。声明为 public static final String SANDBOX_WORKSPACE_PREFIX。

The SANDBOX WORKSPACE PREFIX field.

源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:46

方法详情Method Detail

noShell

public static ShellPathPolicy noShell()
static

返回 noShell 结果。

No shell is available; every filesRoot resolves to null.

返回Returns ShellPathPolicy
返回ShellPathPolicy。Returns shell path policy.
源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:59–61

sandbox

public static ShellPathPolicy sandbox()
static

返回沙箱。

Sandbox mode — paths under the default /workspace/ prefix.

返回Returns ShellPathPolicy
返回ShellPathPolicy。Returns shell path policy.
源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:64–66

sandbox

public static ShellPathPolicy sandbox(String workspacePrefix)
static

设置沙箱。

Sandbox mode with a custom workspace prefix.

参数Parameters
名称Name类型Type说明Description
workspacePrefixString工作区 Prefix(类型 `String`)。absolute path of the workspace root inside the sandbox
返回Returns ShellPathPolicy
返回ShellPathPolicy。Returns shell path policy.
源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:74–79

localWithShell

public static ShellPathPolicy localWithShell(Path workspaceRoot)
static

设置该参数。

Local-with-shell mode — paths absolute on the host.

参数Parameters
名称Name类型Type说明Description
workspaceRootPath工作区根(类型 `Path`)。The workspace root.
返回Returns ShellPathPolicy
返回ShellPathPolicy。Returns shell path policy.
源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:82–87

mode

public Mode mode()

返回模式。

Returns the mode.

返回Returns Mode
返回模式。Returns mode.
源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:89–91

resolve

public String resolve(String skillName, StageResult stage)

执行解析相关操作。

Returns the absolute filesRoot for the given skill, or null when shell is unavailable / the skill has no shell-reachable representation.

参数Parameters
名称Name类型Type说明Description
skillNameString技能's`name`。the skill's `name`
stageStageResult阶段(类型 `StageResult`)。staging outcome from `MarketplaceStager#stage`
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:100–111

嵌套类详情Nested Class Detail

Mode

public enum Mode

定义模式相关取值的枚举。位于 io.agentscope.harness.agent.skill.runtime 包。核心成员包括 NO_SHELL、SANDBOX、LOCAL_WITH_SHELL。

A enum in io.agentscope.harness.agent.skill.runtime that defines enum values used when components lets agents invoke external capabilities under control. Declared in io.agentscope.harness.agent.skill.runtime.

基于官方固定版本源码静态生成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.