From 5015d669ba6836f8988b635898d897991942832a Mon Sep 17 00:00:00 2001 From: "wuqingfu.528" Date: Thu, 5 Feb 2026 17:01:26 +0800 Subject: [PATCH 1/2] feat: adapt skills to byteplus --- veadk/agent.py | 14 ++++++++++++-- veadk/skills/utils.py | 15 +++++++++++++-- veadk/tools/builtin_tools/execute_skills.py | 18 ++++++++++++++---- .../tools/skills_tools/download_skills_tool.py | 12 ++++++++++-- .../tools/skills_tools/register_skills_tool.py | 18 +++++++++++++++--- 5 files changed, 64 insertions(+), 13 deletions(-) diff --git a/veadk/agent.py b/veadk/agent.py index 3e581e7a..1402c7e6 100644 --- a/veadk/agent.py +++ b/veadk/agent.py @@ -361,9 +361,19 @@ def load_skills(self): else: logger.debug("Successfully get AK/SK from environment variables.") + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if provider == "byteplus": + sld = "byteplusapi" + default_region = "ap-southeast-1" + else: + sld = "volcengineapi" + default_region = "cn-beijing" + service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") - region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") - host = service + "." + region + ".volcengineapi.com" + region = os.getenv("AGENTKIT_TOOL_REGION", default_region) + host = os.getenv( + "AGENTKIT_SKILL_HOST", service + "." + region + f".{sld}.com" + ) res = ve_request( request_body={"ToolId": tool_id}, diff --git a/veadk/skills/utils.py b/veadk/skills/utils.py index b0ca0ab4..48007b6a 100644 --- a/veadk/skills/utils.py +++ b/veadk/skills/utils.py @@ -75,8 +75,19 @@ def load_skills_from_cloud(skill_space_ids: str) -> list[Skill]: for skill_space_id in skill_space_ids_list: try: service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") - region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") - host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com") + + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if provider == "byteplus": + sld = "byteplusapi" + default_region = "ap-southeast-1" + else: + sld = "volcengineapi" + default_region = "cn-beijing" + + region = os.getenv("AGENTKIT_TOOL_REGION", default_region) + host = os.getenv( + "AGENTKIT_SKILL_HOST", service + "." + region + f".{sld}.com" + ) access_key = os.getenv("VOLCENGINE_ACCESS_KEY") secret_key = os.getenv("VOLCENGINE_SECRET_KEY") diff --git a/veadk/tools/builtin_tools/execute_skills.py b/veadk/tools/builtin_tools/execute_skills.py index 48e31af6..4a5649b1 100644 --- a/veadk/tools/builtin_tools/execute_skills.py +++ b/veadk/tools/builtin_tools/execute_skills.py @@ -87,9 +87,18 @@ def execute_skills( service = getenv( "AGENTKIT_TOOL_SERVICE_CODE", "agentkit" ) # temporary service for code run tool - region = getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + + cloud_provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if cloud_provider == "byteplus": + sld = "byteplusapi" + default_region = "ap-southeast-1" + else: + sld = "volces" + default_region = "cn-beijing" + + region = getenv("AGENTKIT_TOOL_REGION", default_region) host = getenv( - "AGENTKIT_TOOL_HOST", service + "." + region + ".volces.com" + "AGENTKIT_TOOL_HOST", service + "." + region + f".{sld}.com" ) # temporary host for code run tool logger.debug(f"tools endpoint: {host}") @@ -99,7 +108,6 @@ def execute_skills( tool_user_session_id = agent_name + "_" + user_id + "_" + session_id logger.debug(f"tool_user_session_id: {tool_user_session_id}") - cloud_provider = getenv("CLOUD_PROVIDER", "", allow_false_values=True) scheme = getenv("AGENTKIT_TOOL_SCHEME", "https", allow_false_values=True).lower() if scheme not in {"http", "https"}: scheme = "https" @@ -141,7 +149,9 @@ def execute_skills( service="sts", version="2018-01-01", region=region, - host="sts.volcengineapi.com", + host="sts.volcengineapi.com" + if cloud_provider != "byteplus" + else "open.byteplusapi.com", header=header, ) try: diff --git a/veadk/tools/skills_tools/download_skills_tool.py b/veadk/tools/skills_tools/download_skills_tool.py index c1215a5c..370d3517 100644 --- a/veadk/tools/skills_tools/download_skills_tool.py +++ b/veadk/tools/skills_tools/download_skills_tool.py @@ -65,10 +65,18 @@ def download_skills_tool( secret_key = cred.secret_access_key session_token = cred.session_token + cloud_provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if cloud_provider == "byteplus": + sld = "byteplusapi" + default_region = "ap-southeast-1" + else: + sld = "volces" + default_region = "cn-beijing" + # Get service configuration service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") - region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") - host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com") + region = os.getenv("AGENTKIT_TOOL_REGION", default_region) + host = os.getenv("AGENTKIT_SKILL_HOST", service + "." + region + f".{sld}.com") # Ensure download path exists download_dir = Path(download_path) diff --git a/veadk/tools/skills_tools/register_skills_tool.py b/veadk/tools/skills_tools/register_skills_tool.py index b87c96f4..80722350 100644 --- a/veadk/tools/skills_tools/register_skills_tool.py +++ b/veadk/tools/skills_tools/register_skills_tool.py @@ -87,9 +87,19 @@ def register_skills_tool( try: from veadk.auth.veauth.utils import get_credential_from_vefaas_iam + cloud_provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if cloud_provider == "byteplus": + sld = "byteplusapi" + default_region = "ap-southeast-1" + else: + sld = "volces" + default_region = "cn-beijing" + agentkit_tool_service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") - agentkit_skill_host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com") - region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + region = os.getenv("AGENTKIT_TOOL_REGION", default_region) + agentkit_skill_host = os.getenv( + "AGENTKIT_SKILL_HOST", agentkit_tool_service + "." + region + f".{sld}.com" + ) access_key = os.getenv("VOLCENGINE_ACCESS_KEY") secret_key = os.getenv("VOLCENGINE_SECRET_KEY") @@ -109,7 +119,9 @@ def register_skills_tool( service="sts", version="2018-01-01", region=region, - host="sts.volcengineapi.com", + host="sts.volcengineapi.com" + if cloud_provider != "byteplus" + else "open.byteplusapi.com", header={"X-Security-Token": session_token}, ) try: From 271368e4e4c0a807d03584bb59c987d56c1ce4db Mon Sep 17 00:00:00 2001 From: "wuqingfu.528" Date: Tue, 10 Feb 2026 18:03:57 +0800 Subject: [PATCH 2/2] fix: fix hosts of execute_skills and run_code --- veadk/tools/builtin_tools/execute_skills.py | 2 +- veadk/tools/builtin_tools/run_code.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/veadk/tools/builtin_tools/execute_skills.py b/veadk/tools/builtin_tools/execute_skills.py index 4a5649b1..bccce4a2 100644 --- a/veadk/tools/builtin_tools/execute_skills.py +++ b/veadk/tools/builtin_tools/execute_skills.py @@ -90,7 +90,7 @@ def execute_skills( cloud_provider = (os.getenv("CLOUD_PROVIDER") or "").lower() if cloud_provider == "byteplus": - sld = "byteplusapi" + sld = "bytepluses" default_region = "ap-southeast-1" else: sld = "volces" diff --git a/veadk/tools/builtin_tools/run_code.py b/veadk/tools/builtin_tools/run_code.py index 14a15c4a..22531ced 100644 --- a/veadk/tools/builtin_tools/run_code.py +++ b/veadk/tools/builtin_tools/run_code.py @@ -45,9 +45,18 @@ def run_code( service = getenv( "AGENTKIT_TOOL_SERVICE_CODE", "agentkit" ) # temporary service for code run tool - region = getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + + cloud_provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if cloud_provider == "byteplus": + sld = "bytepluses" + default_region = "ap-southeast-1" + else: + sld = "volces" + default_region = "cn-beijing" + + region = getenv("AGENTKIT_TOOL_REGION", default_region) host = getenv( - "AGENTKIT_TOOL_HOST", service + "." + region + ".volces.com" + "AGENTKIT_TOOL_HOST", service + "." + region + f".{sld}.com" ) # temporary host for code run tool scheme = getenv("AGENTKIT_TOOL_SCHEME", "https", allow_false_values=True).lower() if scheme not in {"http", "https"}: