Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions veadk/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,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},
Expand Down
15 changes: 13 additions & 2 deletions veadk/skills/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
18 changes: 14 additions & 4 deletions veadk/tools/builtin_tools/execute_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "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
logger.debug(f"tools endpoint: {host}")

Expand All @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 11 additions & 2 deletions veadk/tools/builtin_tools/run_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}:
Expand Down
12 changes: 10 additions & 2 deletions veadk/tools/skills_tools/download_skills_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 15 additions & 3 deletions veadk/tools/skills_tools/register_skills_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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:
Expand Down