Skip to content

Commit 43ad192

Browse files
committed
fix: delete TOS_SKILL_DIR env
1 parent e532cfc commit 43ad192

2 files changed

Lines changed: 5 additions & 71 deletions

File tree

veadk/tools/builtin_tools/execute_skills.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -131,28 +131,7 @@ def execute_skills(
131131
if skills:
132132
cmd.extend(["--skills"] + skills)
133133

134-
# TODO: remove after agentkit supports custom environment variables setting
135-
res = ve_request(
136-
request_body={},
137-
action="GetCallerIdentity",
138-
ak=ak,
139-
sk=sk,
140-
service="sts",
141-
version="2018-01-01",
142-
region=region,
143-
host="sts.volcengineapi.com",
144-
header=header,
145-
)
146-
try:
147-
account_id = res["Result"]["AccountId"]
148-
except KeyError as e:
149-
logger.error(f"Error occurred while getting account id: {e}, response is {res}")
150-
return res
151-
152-
env_vars = {
153-
"TOS_SKILLS_DIR": f"tos://agentkit-platform-{account_id}/skills/",
154-
"TOOL_USER_SESSION_ID": tool_user_session_id,
155-
}
134+
env_vars = {"TOOL_USER_SESSION_ID": tool_user_session_id}
156135

157136
code = f"""
158137
import subprocess

veadk/tools/skills_tools/skills_tool.py

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _discover_skills(self) -> str:
117117

118118
service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit")
119119
region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
120-
host = os.getenv("AGENTKIT_SKILL_HOST", "")
120+
host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com")
121121
if not host:
122122
raise RuntimeError(
123123
"AGENTKIT_SKILL_HOST is not set; please provide it via environment variables"
@@ -227,7 +227,7 @@ def _invoke_skill(self, skill_name: str) -> str:
227227

228228
service = os.getenv("AGENTKIT_TOOL_SERVICE_CODE", "agentkit")
229229
region = os.getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
230-
host = os.getenv("AGENTKIT_SKILL_HOST", "")
230+
host = os.getenv("AGENTKIT_SKILL_HOST", "open.volcengineapi.com")
231231
if not host:
232232
raise RuntimeError(
233233
"AGENTKIT_SKILL_HOST is not set; please provide it via environment variables"
@@ -264,47 +264,7 @@ def _invoke_skill(self, skill_name: str) -> str:
264264

265265
result = response.get("Result")
266266

267-
tos_path = result["TosPath"]
268-
269-
tos_skills_dir = os.getenv(
270-
"TOS_SKILLS_DIR"
271-
) # e.g. tos://agentkit-skills/skills/
272-
273-
# Parse bucket and prefix from TOS_SKILLS_DIR
274-
if not tos_skills_dir:
275-
error_msg = (
276-
f"Error: TOS_SKILLS_DIR environment variable is not set. "
277-
f"Cannot download skill '{skill_name}' from remote registry. "
278-
f"Please set TOS_SKILLS_DIR"
279-
)
280-
logger.error(error_msg)
281-
return error_msg
282-
283-
# Validate TOS_SKILLS_DIR format
284-
if not tos_skills_dir.startswith("tos://"):
285-
error_msg = (
286-
f"Error: TOS_SKILLS_DIR format is invalid: '{tos_skills_dir}'. "
287-
f"Expected format: tos://bucket-name/path/to/skills/ "
288-
f"Cannot download skill '{skill_name}'."
289-
)
290-
logger.error(error_msg)
291-
return error_msg
292-
293-
# Parse bucket from TOS_SKILLS_DIR
294-
# Remove "tos://" prefix and split by first "/"
295-
path_without_protocol = tos_skills_dir[6:] # Remove "tos://"
296-
297-
if "/" not in path_without_protocol:
298-
# Only bucket name, no path
299-
tos_bucket = path_without_protocol.rstrip("/")
300-
else:
301-
# Split bucket and path
302-
first_slash_idx = path_without_protocol.index("/")
303-
tos_bucket = path_without_protocol[:first_slash_idx]
304-
305-
logger.info(
306-
f"Parsed TOS location - Bucket: {tos_bucket}, Path: {tos_path}"
307-
)
267+
tos_bucket, tos_path = result["BucketName"], result["TosPath"]
308268

309269
# Initialize VeTOS client
310270
tos_client = VeTOS(
@@ -314,7 +274,7 @@ def _invoke_skill(self, skill_name: str) -> str:
314274
bucket_name=tos_bucket,
315275
)
316276

317-
save_path = f"/tmp/{skill_name}.zip"
277+
save_path = skill_dir.parent / f"{skill_dir.name}.zip"
318278

319279
success = tos_client.download(
320280
bucket_name=tos_bucket,
@@ -338,11 +298,6 @@ def _invoke_skill(self, skill_name: str) -> str:
338298
return (
339299
f"Error: Failed to extract skill '{skill_name}' from zip: {e}"
340300
)
341-
finally:
342-
try:
343-
os.remove(save_path)
344-
except Exception:
345-
pass
346301

347302
logger.info(
348303
f"Successfully downloaded skill '{skill_name}' from skill space"

0 commit comments

Comments
 (0)