类class
agentscope.app.hubSkillHubBase
class SkillHubBase(HubBase, ABC)
源码Source
agentscope/app/hub/_skill/_base.py:26–125技能中心基类,把智能体接入外部消息渠道与企业平台。位于 agentscope.app.hub 包,继承自 HubBase, ABC。核心成员包括 list_skills、get_skill、download。
A hub exposes a browsable catalog of :class:SkillCard records plus
:meth:download, which streams the skill archive the installer
extracts into a workspace.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
async def list_skills(user_id: str, q: str | None = None, cursor: str | None = None, limit: int = 20) -> SkillHubPageasyncabstractabstractmethod | 列出技能。 Browse the hub catalog. |
async def get_skill(user_id: str, card_id: str) -> SkillCardasyncabstractabstractmethod | 获取技能。 Fetch a single card by its hub-local id, with ``SKILL.md``. |
async def download(user_id: str, card_id: str, version: str | None = None) -> SkillArchiveasyncabstractabstractmethod | 用于流式的打开技能归档。 Open the skill archive for streaming. |
方法详情Method Detail
list_skills
async def list_skills(user_id: str, q: str | None = None, cursor: str | None = None, limit: int = 20) -> SkillHubPage
asyncabstractabstractmethod
列出技能。
Implementations must not fetch per-card files here — listing a page costs one upstream request, and SKILL.md is left to :meth:get_skill.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
user_id | str | 用户标识(类型 `str`)。The user identifier to query skill cards for. |
q默认default None | str | None | q(类型 `str | None`)。A keyword filtering the cards. When `None` the whole catalog is browsed. |
cursor默认default None | str | None | 游标(类型 `str | None`)。The opaque cursor from a previous page. When `None` the first page is returned. |
limit默认default 20 | int | 数量上限(类型 `int`)。The maximum number of cards per page. |
SkillHubPage
返回SkillHubPage。`SkillHubPage`:
源码Source
agentscope/app/hub/_skill/_base.py:35–67get_skill
async def get_skill(user_id: str, card_id: str) -> SkillCard
asyncabstractabstractmethod
获取技能。
Fetch a single card by its hub-local id, with SKILL.md.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
user_id | str | 用户标识(类型 `str`)。The user identifier to query the card for. |
card_id | str | 卡片标识(类型 `str`)。The :attr:`SkillCard.id` addressing the card on this hub. |
SkillCard
返回SkillCard。`SkillCard`:
- 可能抛出 `Exception`。`KeyError`:
- 可能抛出 `Exception`。When this hub has no card under `card_id`.
源码Source
agentscope/app/hub/_skill/_base.py:70–90download
async def download(user_id: str, card_id: str, version: str | None = None) -> SkillArchive
asyncabstractabstractmethod
用于流式的打开技能归档。
Returns rather than yields so the format is known before the first byte, and so the caller can pipe the stream onward without ever holding the archive.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
user_id | str | 用户标识(类型 `str`)。The user identifier the download is authorized against. |
card_id | str | 卡片标识(类型 `str`)。The :attr:`SkillCard.id` addressing the card on this hub. |
version默认default None | str | None | 版本(类型 `str | None`)。A specific version to download. When `None` the latest version is used. |
SkillArchive
返回SkillArchive。`SkillArchive`:
- 可能抛出 `Exception`。`KeyError`:
- 可能抛出 `Exception`。When this hub has no card under `card_id`.
源码Source
agentscope/app/hub/_skill/_base.py:93–125