From e638d477c7a3856e4996279ac2b5a29b531c7544 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 28 Aug 2025 15:07:27 +0800 Subject: [PATCH 1/2] add sandbox v1 support --- config.yaml.full | 9 ++++++++ veadk/tools/sandbox/browser_sandbox.py | 28 ++++++++++++++-------- veadk/tools/sandbox/code_sandbox.py | 32 +++++++++++++++++--------- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/config.yaml.full b/config.yaml.full index e9b2db26..daab5fe0 100644 --- a/config.yaml.full +++ b/config.yaml.full @@ -42,6 +42,15 @@ tool: dataset_id: #dataset name mcp_router: url: #mcp sse/streamable-http url + code_sandbox: + url: #mcp sse/streamable-http url + api_key: #mcp api key + browser_sandbox: + url: #mcp sse/streamable-http url + api_key: #mcp api key + computer_sandbox: + url: #mcp sse/streamable-http url + api_key: #mcp api key observability: diff --git a/veadk/tools/sandbox/browser_sandbox.py b/veadk/tools/sandbox/browser_sandbox.py index 668d7d3b..92aa7b7f 100644 --- a/veadk/tools/sandbox/browser_sandbox.py +++ b/veadk/tools/sandbox/browser_sandbox.py @@ -12,16 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -browser_sandbox = ... +from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset +from veadk.config import getenv +from veadk.utils.mcp_utils import get_mcp_params -def browser_use(prompt: str) -> str: - """Using the remote browser sandbox to according to the prompt. +url = getenv("TOOL_BROWSER_SANDBOX_URL") - Args: - prompt (str): The prompt to be used. - Returns: - str: The response from the sandbox. - """ - ... +browser_sandbox = MCPToolset(connection_params=get_mcp_params(url=url)) + +# browser_sandbox = ... + + +# def browser_use(prompt: str) -> str: +# """Using the remote browser sandbox to according to the prompt. + +# Args: +# prompt (str): The prompt to be used. + +# Returns: +# str: The response from the sandbox. +# """ +# ... diff --git a/veadk/tools/sandbox/code_sandbox.py b/veadk/tools/sandbox/code_sandbox.py index 2255210e..b07329a0 100644 --- a/veadk/tools/sandbox/code_sandbox.py +++ b/veadk/tools/sandbox/code_sandbox.py @@ -12,19 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -code_sandbox = ... +from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset +from veadk.config import getenv +from veadk.utils.mcp_utils import get_mcp_params -def code_execution(code: str, language: str) -> str: - """Execute code in sandbox. +url = getenv("TOOL_CODE_SANDBOX_URL") - Args: - code (str): The code to be executed. - language (str): The language of the code. - Returns: - str: The response from the sandbox. - """ +code_sandbox = MCPToolset(connection_params=get_mcp_params(url=url)) - res = code_sandbox(code, language) - return res +# code_sandbox = ... + + +# def code_execution(code: str, language: str) -> str: +# """Execute code in sandbox. + +# Args: +# code (str): The code to be executed. +# language (str): The language of the code. + +# Returns: +# str: The response from the sandbox. +# """ + +# res = code_sandbox(code, language) +# return res From ba6b2ab0fa5563c00f0dce98d3e70f5e1db285fc Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 29 Aug 2025 15:33:45 +0800 Subject: [PATCH 2/2] support sandbox for cua --- veadk/tools/sandbox/computer_sandbox.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/veadk/tools/sandbox/computer_sandbox.py b/veadk/tools/sandbox/computer_sandbox.py index 99d93e76..4e8d19ba 100644 --- a/veadk/tools/sandbox/computer_sandbox.py +++ b/veadk/tools/sandbox/computer_sandbox.py @@ -11,17 +11,24 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset -computer_sandbox = ... +from veadk.config import getenv +from veadk.utils.mcp_utils import get_mcp_params +url = getenv("TOOL_COMPUTER_SANDBOX_URL") -def computer_use(prompt: str) -> str: - """Using the remote computer sandbox to according to the prompt. - Args: - prompt (str): The prompt to be used. +computer_sandbox = MCPToolset(connection_params=get_mcp_params(url=url)) - Returns: - str: The response from the sandbox. - """ - ... + +# def computer_use(prompt: str) -> str: +# """Using the remote computer sandbox to according to the prompt. + +# Args: +# prompt (str): The prompt to be used. + +# Returns: +# str: The response from the sandbox. +# """ +# ...