AS AgentScopeAPI 手册 / API Reference
类class agentscope.tool

ToolGroup

class ToolGroup
源码Source agentscope/tool/_tool_group.py:10–110

工具组,让智能体以受控方式调用外部能力。位于 agentscope.tool 包。核心成员包括 list_skills。

In high-code scenarios, the tools argument accepts any child classes for ToolBase class, and the tool groups supports serialization.

构造器摘要Constructor Summary

构造器Constructor说明Description
def __init__(name: Literal['basic'] | str, description: str | None = None, instructions: str | None = None, tools: list…
初始化 `ToolGroup` 实例。
Initialize the tool group.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
nameLiteral['basic'] | str
名称字段。
—
descriptionstr
`description` 字段。
—
instructionsstr | None
指令字段。
—
toolslist[ToolBase]
工具字段。
—
skills_or_loaderslist[Skill | SkillLoaderBase]
`skills_or_loaders` 字段。
—
mcpslist[MCPClient]
`mcps` 字段。
—

方法摘要Method Summary

方法Method说明Description
async def list_skills() -> list[Skill]async
列出技能。
List all the skills in this tool group.

构造器详情Constructor Detail

ToolGroup

def __init__(name: Literal['basic'] | str, description: str | None = None, instructions: str | None = None, tools: list[ToolBase] | None = None, skills_or_loaders: Sequence[str | Skill | SkillLoaderBase] | None = None, mcps: list[MCPClient] | None = None) -> None

初始化 ToolGroup 实例。

Initialize the tool group.

参数Parameters
名称Name类型Type说明Description
nameLiteral['basic'] | str工具组的名称。The name of the tool group.
description默认default Nonestr | None描述(类型 `str | None`)。The description of the tool group.
instructions默认default Nonestr | None指令(类型 `str | None`)。Instructions included in the meta tool's result upon activation of this tool group, guiding the agent on how to properly use the meta tool.
tools默认default Nonelist[ToolBase] | None工具 in 此组。The tools in this group.
skills_or_loaders默认default NoneSequence[str | Skill | SkillLoaderBase] | None技能或 loaders(类型 `Sequence[str | Skill | SkillLoaderBase] | None`)。The skill paths, data, and loaders to access skills in this group.
mcps默认default Nonelist[MCPClient] | Nonemcps(类型 `list[MCPClient] | None`)。The mcps in this group.
源码Source agentscope/tool/_tool_group.py:41–99

属性详情Attribute Detail

name

Literal['basic'] | str

名称字段。声明为 Literal['basic'] | str。

The name field.

源码Source agentscope/tool/_tool_group.py:19

description

str

description 字段。声明为 str。

The description field.

源码Source agentscope/tool/_tool_group.py:23

instructions

str | None

指令字段。声明为 str | None。

The instructions field.

源码Source agentscope/tool/_tool_group.py:28

tools

list[ToolBase]

工具字段。声明为 list[ToolBase]。

The tools field.

源码Source agentscope/tool/_tool_group.py:32

skills_or_loaders

list[Skill | SkillLoaderBase]

skills_or_loaders 字段。声明为 list[Skill | SkillLoaderBase]。

The skills or loaders field.

源码Source agentscope/tool/_tool_group.py:35

mcps

list[MCPClient]

mcps 字段。声明为 list[MCPClient]。

The mcps field.

源码Source agentscope/tool/_tool_group.py:38

方法详情Method Detail

list_skills

async def list_skills() -> list[Skill]
async

列出技能。

List all the skills in this tool group.

返回Returns list[Skill]
返回技能列表。Returns a list of skill.
源码Source agentscope/tool/_tool_group.py:101–110
基于官方固定版本源码静态生成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.