@@ -11779,8 +11779,8 @@ def test_filesystem_expands_to_file_tools(self):
1177911779 "move_file" ,
1178011780 }
1178111781
11782- def test_environment_adds_sandbox_tools (self ):
11783- """When agent has environment_config, sandbox tools are appended ."""
11782+ def test_environment_does_not_add_sandbox_tools (self ):
11783+ """Sandbox tools should NOT appear even when agent has environment ."""
1178411784 agent_json = {
1178511785 "tools" : [{"type" : "code_execution" }],
1178611786 "environment_config" : {"some_field" : "value" },
@@ -11791,17 +11791,17 @@ def test_environment_adds_sandbox_tools(self):
1179111791 mock_api_client ,
1179211792 "projects/p/locations/l/agents/a" ,
1179311793 )
11794- # code_execution + sandbox tool
11795- assert len (result .tools ) == 2
11794+ # Only code_execution, no sandbox tools.
11795+ assert len (result .tools ) == 1
1179611796 all_decl_names = {
1179711797 fd .name
1179811798 for t in result .tools
1179911799 if t .function_declarations
1180011800 for fd in t .function_declarations
1180111801 }
1180211802 assert "run_command" in all_decl_names
11803- assert "provision_sandbox" in all_decl_names
11804- assert "load_sandbox" in all_decl_names
11803+ assert "provision_sandbox" not in all_decl_names
11804+ assert "load_sandbox" not in all_decl_names
1180511805
1180611806 def test_mcp_server_kept_as_named_declaration (self ):
1180711807 """mcp_server entries are kept as named declarations, not dropped."""
@@ -11831,17 +11831,23 @@ def test_mcp_server_kept_as_named_declaration(self):
1183111831 def test_catalog_in_sync_with_server (self ):
1183211832 """SDK catalog keys and function names match the server-side catalog.
1183311833
11834- The SDK-side BUILTIN_TOOL_DECLARATIONS and SANDBOX_DECLARATIONS in
11835- _evals_builtin_tools are a display-only copy of the authoritative
11836- server-side catalog in interaction_converter.py. This test imports
11837- both and asserts that tool-type keys and declaration names stay in
11838- sync. If this test fails, update _evals_builtin_tools.py to match.
11834+ The SDK-side BUILTIN_TOOL_DECLARATIONS in _evals_builtin_tools is a
11835+ display-only copy of the authoritative server-side catalog in
11836+ interaction_converter.py. This test imports both and asserts that
11837+ tool-type keys and declaration names stay in sync. If this test
11838+ fails, update _evals_builtin_tools.py to match.
11839+
11840+ Sandbox tool declarations (provision_sandbox, load_sandbox) are
11841+ intentionally excluded from both the SDK and server AgentConfig
11842+ tool catalogs, so no sync check is needed for them.
1183911843 """
1184011844 # pylint: disable=g-import-not-at-top
1184111845 try :
1184211846 from cloud .ai .platform .evaluation .utils import interaction_converter
1184311847 except ImportError :
11844- pytest .skip ("interaction_converter not available outside google3" )
11848+ pytest .skip (
11849+ "interaction_converter not available outside google3"
11850+ )
1184511851 # pylint: enable=g-import-not-at-top
1184611852
1184711853 # --- Built-in tool types: keys must match ---
@@ -11859,9 +11865,7 @@ def test_catalog_in_sync_with_server(self):
1185911865 for tool_type in server_builtin_keys :
1186011866 server_names = {
1186111867 fd .name
11862- for fd in interaction_converter ._BUILTIN_TOOL_FUNCTION_DECLARATIONS [
11863- tool_type
11864- ]
11868+ for fd in interaction_converter ._BUILTIN_TOOL_FUNCTION_DECLARATIONS [tool_type ]
1186511869 }
1186611870 sdk_names = {
1186711871 fd .name
@@ -11873,17 +11877,14 @@ def test_catalog_in_sync_with_server(self):
1187311877 f" SDK: { sorted (sdk_names )} "
1187411878 )
1187511879
11876- # --- Sandbox declarations: names must match ---
11877- server_sandbox_names = {
11878- fd .name for fd in interaction_converter .sandbox_function_declarations ()
11879- }
11880- sdk_sandbox_names = {
11881- fd .name for fd in _evals_builtin_tools .SANDBOX_DECLARATIONS
11882- }
11883- assert sdk_sandbox_names == server_sandbox_names , (
11884- f"SANDBOX_DECLARATIONS names out of sync.\n "
11880+ # --- Sandbox tool names: SDK names must match server names ---
11881+ server_sandbox_names = set (
11882+ interaction_converter ._SANDBOX_TOOL_NAMES
11883+ )
11884+ assert _evals_builtin_tools .SANDBOX_TOOL_NAMES == server_sandbox_names , (
11885+ f"SANDBOX_TOOL_NAMES out of sync.\n "
1188511886 f" Server: { sorted (server_sandbox_names )} \n "
11886- f" SDK: { sorted (sdk_sandbox_names )} "
11887+ f" SDK: { sorted (_evals_builtin_tools . SANDBOX_TOOL_NAMES )} "
1188711888 )
1188811889
1188911890
0 commit comments