Skip to content

Commit 7b267c4

Browse files
committed
feat: support skills in byteplus
1 parent 42edc02 commit 7b267c4

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed

veadk/agent.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,19 @@ def load_skills(self):
363363

364364
service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit")
365365
region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
366+
# volcengine example: agentkit.cn-beijing.volcengineapi.com
366367
host = service + "." + region + ".volcengineapi.com"
367368

369+
provider = (os.getenv("CLOUD_PROVIDER") or "").lower()
370+
if provider == "byteplus":
371+
region = (
372+
os.getenv("REGION")
373+
or os.getenv("AGENTKIT_TOOL_REGION")
374+
or "ap-southeast-1"
375+
)
376+
# byteplus example: agentkit.ap-southeast-1.bytepluses.com
377+
host = service + "." + region + ".bytepluses.com"
378+
368379
res = ve_request(
369380
request_body={"ToolId": tool_id},
370381
action="GetTool",

veadk/skills/utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,19 @@ def load_skills_from_cloud(skill_space_ids: str) -> list[Skill]:
7676
try:
7777
service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit")
7878
region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
79+
# volcengine example: agentkit.cn-beijing.open.volcengineapi.com
7980
host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com")
8081

82+
provider = (os.getenv("CLOUD_PROVIDER") or "").lower()
83+
if provider == "byteplus":
84+
region = (
85+
os.getenv("REGION")
86+
or os.getenv("AGENTKIT_TOOL_REGION")
87+
or "ap-southeast-1"
88+
)
89+
# byteplus example: agentkit.ap-southeast-1.byteplusapi.com
90+
host = os.getenv("AGENTKIT_SKILL_HOST", "byteplusapi.com")
91+
8192
access_key = os.getenv("VOLCENGINE_ACCESS_KEY")
8293
secret_key = os.getenv("VOLCENGINE_SECRET_KEY")
8394
session_token = ""

veadk/tools/builtin_tools/execute_skills.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,18 @@ def execute_skills(
8888
"AGENTKIT_TOOL_SERVICE_CODE", "agentkit"
8989
) # temporary service for code run tool
9090
region = getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
91+
# volces example: agentkit.cn-beijing.volces.com
9192
host = getenv(
9293
"AGENTKIT_TOOL_HOST", service + "." + region + ".volces.com"
9394
) # temporary host for code run tool
95+
96+
provider = (os.getenv("CLOUD_PROVIDER") or "").lower()
97+
if provider == "byteplus":
98+
region = (
99+
os.getenv("REGION") or os.getenv("AGENTKIT_TOOL_REGION") or "ap-southeast-1"
100+
)
101+
# byteplus example: agentkit.ap-southeast-1.bytepluses.com
102+
host = getenv("AGENTKIT_TOOL_HOST", service + "." + region + ".bytepluses.com")
94103
logger.debug(f"tools endpoint: {host}")
95104

96105
session_id = tool_context._invocation_context.session.id

veadk/tools/builtin_tools/run_code.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,19 @@ def run_code(
4646
"AGENTKIT_TOOL_SERVICE_CODE", "agentkit"
4747
) # temporary service for code run tool
4848
region = getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
49+
# volces example: agentkit.cn-beijing.volces.com
4950
host = getenv(
5051
"AGENTKIT_TOOL_HOST", service + "." + region + ".volces.com"
5152
) # temporary host for code run tool
53+
54+
provider = (os.getenv("CLOUD_PROVIDER") or "").lower()
55+
if provider == "byteplus":
56+
region = (
57+
os.getenv("REGION") or os.getenv("AGENTKIT_TOOL_REGION") or "ap-southeast-1"
58+
)
59+
# byteplus example: agentkit.ap-southeast-1.bytepluses.com
60+
host = getenv("AGENTKIT_TOOL_HOST", service + "." + region + ".bytepluses.com")
61+
5262
scheme = getenv("AGENTKIT_TOOL_SCHEME", "https", allow_false_values=True).lower()
5363
if scheme not in {"http", "https"}:
5464
scheme = "https"

veadk/tools/skills_tools/download_skills_tool.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,19 @@ def download_skills_tool(
6868
# Get service configuration
6969
service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit")
7070
region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
71+
# volcengine example: agentkit.cn-beijing.open.volcengineapi.com
7172
host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com")
7273

74+
provider = (os.getenv("CLOUD_PROVIDER") or "").lower()
75+
if provider == "byteplus":
76+
region = (
77+
os.getenv("REGION")
78+
or os.getenv("AGENTKIT_TOOL_REGION")
79+
or "ap-southeast-1"
80+
)
81+
# byteplus example: agentkit-ppe.ap-southeast-1.byteplusapi.com
82+
host = os.getenv("AGENTKIT_SKILL_HOST", "byteplusapi.com")
83+
7384
# Ensure download path exists
7485
download_dir = Path(download_path)
7586
download_dir.mkdir(parents=True, exist_ok=True)

veadk/tools/skills_tools/register_skills_tool.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,19 @@ def register_skills_tool(
8888
from veadk.auth.veauth.utils import get_credential_from_vefaas_iam
8989

9090
agentkit_tool_service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit")
91+
# volcengine example: agentkit.cn-beijing.volcengineapi.com
9192
agentkit_skill_host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com")
9293
region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
94+
provider = (os.getenv("CLOUD_PROVIDER") or "").lower()
95+
96+
if provider == "byteplus":
97+
region = (
98+
os.getenv("REGION")
99+
or os.getenv("AGENTKIT_TOOL_REGION")
100+
or "ap-southeast-1"
101+
)
102+
# byteplus example: agentkit-ppe.ap-southeast-1.byteplusapi.com
103+
agentkit_skill_host = os.getenv("AGENTKIT_SKILL_HOST", "byteplusapi.com")
93104

94105
access_key = os.getenv("VOLCENGINE_ACCESS_KEY")
95106
secret_key = os.getenv("VOLCENGINE_SECRET_KEY")

0 commit comments

Comments
 (0)