AgentSpecCodec
public final class AgentSpecCodec
io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:34–357智能体规格编解码器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.catalog.spec 包。核心成员包括 defaultToolsets、toToolsConfig、toPermissionPolicyMap、toHarnessToolName、toolsetsFromAllowList、workspaceSkills。
Converts Agent body tool/MCP/skills structures to harness ToolsConfig and policy maps.
方法摘要Method Summary
方法详情Method Detail
defaultToolsets
public static List<AgentToolset> defaultToolsets()
返回 defaultToolsets 结果。
Default toolset: all builtins enabled, always_allow.
List<AgentToolset>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:41–49toToolsConfig
public static ToolsConfig toToolsConfig(List<AgentToolset> tools, List<McpServerSpec> mcpServers)
执行到工具配置相关操作。
Derives harness tools.json content from Agent body toolsets + mcpServers.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
tools | List<AgentToolset> | 工具列表(类型 `List`)。The tools. |
mcpServers | List<McpServerSpec> | MCP Servers(类型 `List`)。The mcp servers. |
ToolsConfigio/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:52–157toPermissionPolicyMap
public static Map<String, String> toPermissionPolicyMap(List<AgentToolset> tools)
设置到权限策略映射。
Flattens per-tool permission policies for ToolConfirmationMiddleware.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
tools | List<AgentToolset> | 工具列表(类型 `List`)。The tools. |
Map<String, String>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:160–199toHarnessToolName
public static String toHarnessToolName(String productName)
设置该参数。
Maps product catalog tool ids (Claude-aligned names and legacy aliases) to Harness tool names.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
productName | String | product 名称(类型 `String`)。The product name. |
Stringio/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:205–219toolsetsFromAllowList
public static List<AgentToolset> toolsetsFromAllowList(List<String> allow)
设置该参数。
Builds agent_toolset from a flat allow list (e.g.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
allow | List<String> | allow(类型 `List`)。The allow. |
List<AgentToolset>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:222–242workspaceSkills
public static List<SkillRef> workspaceSkills(List<String> names)
设置工作区技能。
Performs the workspace skills operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
names | List<String> | names(类型 `List`)。The names. |
List<SkillRef>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:244–256workspaceSkillNames
public static List<String> workspaceSkillNames(List<SkillRef> skills)
设置该参数。
Performs the workspace skill names operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skills | List<SkillRef> | 技能(类型 `List`)。The skills. |
List<String>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:258–279writeJson
public static String writeJson(Object value)
设置写入 JSON。
Performs the write json operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | Object | 值(类型 `Object`)。The value. |
Stringio/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:281–290readJson
public static T T readJson(String json, TypeReference<T> type)
执行读取 JSON相关操作。
Performs the read json operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
type | TypeReference<T> | 类型(类型 `TypeReference`)。The type. |
Tio/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:292–301readTools
public static List<AgentToolset> readTools(String json)
设置读取工具。
Performs the read tools operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
List<AgentToolset>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:303–306readMcpServers
public static List<McpServerSpec> readMcpServers(String json)
设置该参数。
Performs the read mcp servers operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
List<McpServerSpec>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:308–311readSkills
public static List<SkillRef> readSkills(String json)
设置读取技能。
Performs the read skills operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
List<SkillRef>io/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:313–316readMultiagent
public static AgentSpecTypes.MultiagentSpec readMultiagent(String json)
设置读取多智能体。
Performs the read multiagent operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
AgentSpecTypes.MultiagentSpecio/agentscope/builder/web/catalog/spec/AgentSpecCodec.java:318–320