From 7b267c47d29f2af6b7ea5cca3a7ad64202fbf0c1 Mon Sep 17 00:00:00 2001 From: warm-wm Date: Sat, 7 Feb 2026 22:02:17 +0800 Subject: [PATCH] feat: support skills in byteplus --- veadk/agent.py | 11 +++++++++++ veadk/skills/utils.py | 11 +++++++++++ veadk/tools/builtin_tools/execute_skills.py | 9 +++++++++ veadk/tools/builtin_tools/run_code.py | 10 ++++++++++ veadk/tools/skills_tools/download_skills_tool.py | 11 +++++++++++ veadk/tools/skills_tools/register_skills_tool.py | 11 +++++++++++ 6 files changed, 63 insertions(+) diff --git a/veadk/agent.py b/veadk/agent.py index 3e581e7a..00db045b 100644 --- a/veadk/agent.py +++ b/veadk/agent.py @@ -363,8 +363,19 @@ def load_skills(self): service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + # volcengine example: agentkit.cn-beijing.volcengineapi.com host = service + "." + region + ".volcengineapi.com" + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if provider == "byteplus": + region = ( + os.getenv("REGION") + or os.getenv("AGENTKIT_TOOL_REGION") + or "ap-southeast-1" + ) + # byteplus example: agentkit.ap-southeast-1.bytepluses.com + host = service + "." + region + ".bytepluses.com" + res = ve_request( request_body={"ToolId": tool_id}, action="GetTool", diff --git a/veadk/skills/utils.py b/veadk/skills/utils.py index b0ca0ab4..5576ce4e 100644 --- a/veadk/skills/utils.py +++ b/veadk/skills/utils.py @@ -76,8 +76,19 @@ def load_skills_from_cloud(skill_space_ids: str) -> list[Skill]: try: service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + # volcengine example: agentkit.cn-beijing.open.volcengineapi.com host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com") + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if provider == "byteplus": + region = ( + os.getenv("REGION") + or os.getenv("AGENTKIT_TOOL_REGION") + or "ap-southeast-1" + ) + # byteplus example: agentkit.ap-southeast-1.byteplusapi.com + host = os.getenv("AGENTKIT_SKILL_HOST", "byteplusapi.com") + access_key = os.getenv("VOLCENGINE_ACCESS_KEY") secret_key = os.getenv("VOLCENGINE_SECRET_KEY") session_token = "" diff --git a/veadk/tools/builtin_tools/execute_skills.py b/veadk/tools/builtin_tools/execute_skills.py index 48e31af6..c419e280 100644 --- a/veadk/tools/builtin_tools/execute_skills.py +++ b/veadk/tools/builtin_tools/execute_skills.py @@ -88,9 +88,18 @@ def execute_skills( "AGENTKIT_TOOL_SERVICE_CODE", "agentkit" ) # temporary service for code run tool region = getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + # volces example: agentkit.cn-beijing.volces.com host = getenv( "AGENTKIT_TOOL_HOST", service + "." + region + ".volces.com" ) # temporary host for code run tool + + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if provider == "byteplus": + region = ( + os.getenv("REGION") or os.getenv("AGENTKIT_TOOL_REGION") or "ap-southeast-1" + ) + # byteplus example: agentkit.ap-southeast-1.bytepluses.com + host = getenv("AGENTKIT_TOOL_HOST", service + "." + region + ".bytepluses.com") logger.debug(f"tools endpoint: {host}") session_id = tool_context._invocation_context.session.id diff --git a/veadk/tools/builtin_tools/run_code.py b/veadk/tools/builtin_tools/run_code.py index 14a15c4a..4f342567 100644 --- a/veadk/tools/builtin_tools/run_code.py +++ b/veadk/tools/builtin_tools/run_code.py @@ -46,9 +46,19 @@ def run_code( "AGENTKIT_TOOL_SERVICE_CODE", "agentkit" ) # temporary service for code run tool region = getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + # volces example: agentkit.cn-beijing.volces.com host = getenv( "AGENTKIT_TOOL_HOST", service + "." + region + ".volces.com" ) # temporary host for code run tool + + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if provider == "byteplus": + region = ( + os.getenv("REGION") or os.getenv("AGENTKIT_TOOL_REGION") or "ap-southeast-1" + ) + # byteplus example: agentkit.ap-southeast-1.bytepluses.com + host = getenv("AGENTKIT_TOOL_HOST", service + "." + region + ".bytepluses.com") + scheme = getenv("AGENTKIT_TOOL_SCHEME", "https", allow_false_values=True).lower() if scheme not in {"http", "https"}: scheme = "https" diff --git a/veadk/tools/skills_tools/download_skills_tool.py b/veadk/tools/skills_tools/download_skills_tool.py index c1215a5c..de90fe4f 100644 --- a/veadk/tools/skills_tools/download_skills_tool.py +++ b/veadk/tools/skills_tools/download_skills_tool.py @@ -68,8 +68,19 @@ def download_skills_tool( # Get service configuration service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + # volcengine example: agentkit.cn-beijing.open.volcengineapi.com host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com") + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + if provider == "byteplus": + region = ( + os.getenv("REGION") + or os.getenv("AGENTKIT_TOOL_REGION") + or "ap-southeast-1" + ) + # byteplus example: agentkit-ppe.ap-southeast-1.byteplusapi.com + host = os.getenv("AGENTKIT_SKILL_HOST", "byteplusapi.com") + # Ensure download path exists download_dir = Path(download_path) download_dir.mkdir(parents=True, exist_ok=True) diff --git a/veadk/tools/skills_tools/register_skills_tool.py b/veadk/tools/skills_tools/register_skills_tool.py index b87c96f4..59880fa4 100644 --- a/veadk/tools/skills_tools/register_skills_tool.py +++ b/veadk/tools/skills_tools/register_skills_tool.py @@ -88,8 +88,19 @@ def register_skills_tool( from veadk.auth.veauth.utils import get_credential_from_vefaas_iam agentkit_tool_service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit") + # volcengine example: agentkit.cn-beijing.volcengineapi.com agentkit_skill_host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com") region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing") + provider = (os.getenv("CLOUD_PROVIDER") or "").lower() + + if provider == "byteplus": + region = ( + os.getenv("REGION") + or os.getenv("AGENTKIT_TOOL_REGION") + or "ap-southeast-1" + ) + # byteplus example: agentkit-ppe.ap-southeast-1.byteplusapi.com + agentkit_skill_host = os.getenv("AGENTKIT_SKILL_HOST", "byteplusapi.com") access_key = os.getenv("VOLCENGINE_ACCESS_KEY") secret_key = os.getenv("VOLCENGINE_SECRET_KEY")