AS AgentScopeAPI 手册 / API Reference
类class agentscope.app.hub

SkillHubBase

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_idstr用户标识(类型 `str`)。The user identifier to query skill cards for.
q默认default Nonestr | Noneq(类型 `str | None`)。A keyword filtering the cards. When `None` the whole catalog is browsed.
cursor默认default Nonestr | None游标(类型 `str | None`)。The opaque cursor from a previous page. When `None` the first page is returned.
limit默认default 20int数量上限(类型 `int`)。The maximum number of cards per page.
返回Returns SkillHubPage
返回SkillHubPage。`SkillHubPage`:
源码Source agentscope/app/hub/_skill/_base.py:35–67

get_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_idstr用户标识(类型 `str`)。The user identifier to query the card for.
card_idstr卡片标识(类型 `str`)。The :attr:`SkillCard.id` addressing the card on this hub.
返回Returns SkillCard
返回SkillCard。`SkillCard`:
异常Raises
  • 可能抛出 `Exception`。`KeyError`:
  • 可能抛出 `Exception`。When this hub has no card under `card_id`.
源码Source agentscope/app/hub/_skill/_base.py:70–90

download

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_idstr用户标识(类型 `str`)。The user identifier the download is authorized against.
card_idstr卡片标识(类型 `str`)。The :attr:`SkillCard.id` addressing the card on this hub.
version默认default Nonestr | None版本(类型 `str | None`)。A specific version to download. When `None` the latest version is used.
返回Returns SkillArchive
返回SkillArchive。`SkillArchive`:
异常Raises
  • 可能抛出 `Exception`。`KeyError`:
  • 可能抛出 `Exception`。When this hub has no card under `card_id`.
源码Source agentscope/app/hub/_skill/_base.py:93–125

继承成员Inherited Members

继承自Inherited from HubBase
基于官方固定版本源码静态生成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.