feat: support skill version qualifier in download #129
Open
yuyushui66 wants to merge 1 commit into
Open
Conversation
Add `qualifier` parameter to `Tool.download_skill()` and `download_skill_async()` so callers can request a specific skill version (e.g. "v1.0.0", "default", "LATEST") from the data plane download endpoint. `skill_tools()` accepts the same version semantics via the "name@qualifier" string syntax (for str/list inputs) or the `qualifier=` keyword (for ToolResource inputs); each list element can specify its own version independently. Specifying a qualifier forces re-download to avoid serving a stale local copy. `SkillLoader` is refactored internally to carry (name, qualifier) tuples; the legacy `remote_skill_names` parameter is replaced by `remote_skills`. Code scans confirm no external caller used the legacy parameter, so this is backward compatible in practice. Signed-off-by: daoxun.yds <daoxun.yds@alibaba-inc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tool.download_skill()/download_skill_async()新增qualifier参数,支持下载指定版本的 Skill(如"v1.0.0"、"default"、"LATEST")skill_tools()支持"name@qualifier"字符串语法和qualifier=kwarg,列表入参时每个 skill 可独立指定版本Background
后端 (
funagent-core) 已实现 Skill 版本管理控制面 API 和数据面版本化下载端点:本 PR 让 Python SDK 暴露这一能力,使 Agent Runtime / 业务代码可以在下载 Skill 时锁定版本,避免因 LATEST 漂移导致行为变化。
Changes
公开 API(新增可选参数,向后兼容)
Tool.download_skill()qualifier: Optional[str] = NoneTool.download_skill_async()qualifier: Optional[str] = Noneskill_tools()qualifier: Optional[str] = Nonekwarg;name入参字符串/列表元素支持"@qualifier"语法用法示例
关键设计决策
@作分隔符:工具名受后端正则^[_a-zA-Z][-_a-zA-Z0-9]*$约束不含@,分隔符无歧义;使用rsplit('@', 1)解析qualifier用urllib.parse.quote(..., safe='')编码,确保 RAM 签名正确"name@"视为不指定版本;"@v1.0.0"抛ValueError内部重构
SkillLoader.__init__参数remote_skill_names: List[str]→remote_skills: List[Tuple[str, Optional[str]]],以承载每个 skill 的独立版本号remote_skill_names,所以此变更实际零影响_parse_skill_qualifier()用于解析"name@qualifier"语法Compatibility
tool.download_skill()skill_tools("name")skill_tools(["a", "b"])skill_tools(tool)AGENTRUN_SKILL_NAMES="a,b"tool.download_skill(qualifier="v1.0.0")skill_tools("name@v1.0.0")AGENTRUN_SKILL_NAMES="a@v1.0.0,b"Test Plan
tests/unittests/integration/test_skill_loader.py:新增 12 个测试覆盖_parse_skill_qualifier、SkillLoaderqualifier 处理、skill_tools各种入参形式tests/unittests/tool/test_tool.py:新增 3 个测试覆盖_get_skill_download_url的 qualifier URL 生成与 URL 编码make codegen重新生成agentrun/tool/tool.pyRelated
funagent-coreSkill 版本管理服务(PublishVersion / ListVersions / GetVersionByQualifier)GET /tools/{name}/download?qualifier={version}