From 32463863bd666f4db7ced1ff221e5dd7a747a619 Mon Sep 17 00:00:00 2001 From: alex-clawd Date: Tue, 19 May 2026 22:57:35 -0700 Subject: [PATCH] fix: align OSS client with AMP API contract - download_skill(): fetch download_url (presigned URL) instead of expecting inline base64. Falls back to 'file' field for compat. - Read 'latest_version' field, fall back to 'version' - Same fixes applied to CLI install() command --- lib/cli/src/crewai_cli/skills/main.py | 19 ++++++++++++++----- lib/crewai/src/crewai/skills/registry.py | 21 +++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/cli/src/crewai_cli/skills/main.py b/lib/cli/src/crewai_cli/skills/main.py index 84f4b1b4b..07ccef377 100644 --- a/lib/cli/src/crewai_cli/skills/main.py +++ b/lib/cli/src/crewai_cli/skills/main.py @@ -130,11 +130,20 @@ class SkillCommand(BaseCommand, PlusAPIMixin): raise SystemExit(1) data = get_response.json() - encoded = data.get("file", "") - if "," in encoded: - encoded = encoded.split(",", 1)[1] - archive_bytes = base64.b64decode(encoded) - version = data.get("version") + version = data.get("latest_version") or data.get("version") + + download_url = data.get("download_url") + if download_url: + import httpx + + dl_response = httpx.get(download_url, follow_redirects=True) + dl_response.raise_for_status() + archive_bytes = dl_response.content + else: + encoded = data.get("file", "") + if "," in encoded: + encoded = encoded.split(",", 1)[1] + archive_bytes = base64.b64decode(encoded) in_project = os.path.isfile("pyproject.toml") if in_project: diff --git a/lib/crewai/src/crewai/skills/registry.py b/lib/crewai/src/crewai/skills/registry.py index 5024e0ec2..7b3dc83a6 100644 --- a/lib/crewai/src/crewai/skills/registry.py +++ b/lib/crewai/src/crewai/skills/registry.py @@ -186,12 +186,21 @@ def download_skill( import base64 - encoded = data.get("file", "") - # Strip data URI prefix if present - if "," in encoded: - encoded = encoded.split(",", 1)[1] - archive_bytes = base64.b64decode(encoded) - version = data.get("version") + import httpx + + version = data.get("latest_version") or data.get("version") + + download_url = data.get("download_url") + if download_url: + dl_response = httpx.get(download_url, follow_redirects=True) + dl_response.raise_for_status() + archive_bytes = dl_response.content + else: + encoded = data.get("file", "") + # Strip data URI prefix if present + if "," in encoded: + encoded = encoded.split(",", 1)[1] + archive_bytes = base64.b64decode(encoded) cache = SkillCacheManager() skill_dir = cache.store(org, name, version, archive_bytes)