Skip to content

Commit 17b2fca

Browse files
authored
feat(tools): add sandbox v1 support (#114)
1 parent 01525be commit 17b2fca

File tree

3 files changed

+49
-20
lines changed

3 files changed

+49
-20
lines changed

config.yaml.full

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ tool:
4242
dataset_id: #dataset name
4343
mcp_router:
4444
url: #mcp sse/streamable-http url
45+
code_sandbox:
46+
url: #mcp sse/streamable-http url
47+
api_key: #mcp api key
48+
browser_sandbox:
49+
url: #mcp sse/streamable-http url
50+
api_key: #mcp api key
51+
computer_sandbox:
52+
url: #mcp sse/streamable-http url
53+
api_key: #mcp api key
4554

4655

4756
observability:

veadk/tools/sandbox/browser_sandbox.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,26 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
browser_sandbox = ...
15+
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
1616

17+
from veadk.config import getenv
18+
from veadk.utils.mcp_utils import get_mcp_params
1719

18-
def browser_use(prompt: str) -> str:
19-
"""Using the remote browser sandbox to according to the prompt.
20+
url = getenv("TOOL_BROWSER_SANDBOX_URL")
2021

21-
Args:
22-
prompt (str): The prompt to be used.
2322

24-
Returns:
25-
str: The response from the sandbox.
26-
"""
27-
...
23+
browser_sandbox = MCPToolset(connection_params=get_mcp_params(url=url))
24+
25+
# browser_sandbox = ...
26+
27+
28+
# def browser_use(prompt: str) -> str:
29+
# """Using the remote browser sandbox to according to the prompt.
30+
31+
# Args:
32+
# prompt (str): The prompt to be used.
33+
34+
# Returns:
35+
# str: The response from the sandbox.
36+
# """
37+
# ...

veadk/tools/sandbox/code_sandbox.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,29 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
code_sandbox = ...
15+
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
1616

17+
from veadk.config import getenv
18+
from veadk.utils.mcp_utils import get_mcp_params
1719

18-
def code_execution(code: str, language: str) -> str:
19-
"""Execute code in sandbox.
20+
url = getenv("TOOL_CODE_SANDBOX_URL")
2021

21-
Args:
22-
code (str): The code to be executed.
23-
language (str): The language of the code.
2422

25-
Returns:
26-
str: The response from the sandbox.
27-
"""
23+
code_sandbox = MCPToolset(connection_params=get_mcp_params(url=url))
2824

29-
res = code_sandbox(code, language)
30-
return res
25+
# code_sandbox = ...
26+
27+
28+
# def code_execution(code: str, language: str) -> str:
29+
# """Execute code in sandbox.
30+
31+
# Args:
32+
# code (str): The code to be executed.
33+
# language (str): The language of the code.
34+
35+
# Returns:
36+
# str: The response from the sandbox.
37+
# """
38+
39+
# res = code_sandbox(code, language)
40+
# return res

0 commit comments

Comments
 (0)