Skip to content

Commit 99a461f

Browse files
authored
feat: allow subagent to start code sandbox in parallel (#262)
* allow subagent to start code sandbox in parallel * allow subagent to start multiple code sandbox in parallel
1 parent 7c51813 commit 99a461f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

veadk/tools/builtin_tools/run_code.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def run_code(code: str, language: str, tool_context: ToolContext) -> str:
4242
region = getenv("AGENTKIT_TOOL_REGION", "cn-beijing")
4343

4444
session_id = tool_context._invocation_context.session.id
45+
agent_name = tool_context._invocation_context.agent.name
46+
user_id = tool_context._invocation_context.user_id
47+
tool_user_session_id = agent_name + "_" + user_id + "_" + session_id
48+
logger.debug(f"tool_user_session_id: {tool_user_session_id}")
4549

4650
logger.debug(
4751
f"Running code in language: {language}, session_id={session_id}, code={code}, tool_id={tool_id}, host={host}, service={service}, region={region}"
@@ -53,7 +57,7 @@ def run_code(code: str, language: str, tool_context: ToolContext) -> str:
5357
res = ve_request(
5458
request_body={
5559
"ToolId": tool_id,
56-
"UserSessionId": session_id,
60+
"UserSessionId": tool_user_session_id,
5761
"OperationType": "RunCode",
5862
"OperationPayload": json.dumps(
5963
{

0 commit comments

Comments
 (0)