@@ -12010,8 +12010,8 @@ def test_filesystem_expands_to_file_tools(self):
1201012010 "move_file" ,
1201112011 }
1201212012
12013- def test_environment_adds_sandbox_tools (self ):
12014- """When agent has environment_config, sandbox tools are appended ."""
12013+ def test_environment_does_not_add_sandbox_tools (self ):
12014+ """Sandbox tools should NOT appear even when agent has environment ."""
1201512015 agent_json = {
1201612016 "tools" : [{"type" : "code_execution" }],
1201712017 "environment_config" : {"some_field" : "value" },
@@ -12022,17 +12022,17 @@ def test_environment_adds_sandbox_tools(self):
1202212022 mock_api_client ,
1202312023 "projects/p/locations/l/agents/a" ,
1202412024 )
12025- # code_execution + sandbox tool
12026- assert len (result .tools ) == 2
12025+ # Only code_execution, no sandbox tools.
12026+ assert len (result .tools ) == 1
1202712027 all_decl_names = {
1202812028 fd .name
1202912029 for t in result .tools
1203012030 if t .function_declarations
1203112031 for fd in t .function_declarations
1203212032 }
1203312033 assert "run_command" in all_decl_names
12034- assert "provision_sandbox" in all_decl_names
12035- assert "load_sandbox" in all_decl_names
12034+ assert "provision_sandbox" not in all_decl_names
12035+ assert "load_sandbox" not in all_decl_names
1203612036
1203712037 def test_mcp_server_kept_as_named_declaration (self ):
1203812038 """mcp_server entries are kept as named declarations, not dropped."""
@@ -12062,17 +12062,23 @@ def test_mcp_server_kept_as_named_declaration(self):
1206212062 def test_catalog_in_sync_with_server (self ):
1206312063 """SDK catalog keys and function names match the server-side catalog.
1206412064
12065- The SDK-side BUILTIN_TOOL_DECLARATIONS and SANDBOX_DECLARATIONS in
12066- _evals_builtin_tools are a display-only copy of the authoritative
12067- server-side catalog in interaction_converter.py. This test imports
12068- both and asserts that tool-type keys and declaration names stay in
12069- sync. If this test fails, update _evals_builtin_tools.py to match.
12065+ The SDK-side BUILTIN_TOOL_DECLARATIONS in _evals_builtin_tools is a
12066+ display-only copy of the authoritative server-side catalog in
12067+ interaction_converter.py. This test imports both and asserts that
12068+ tool-type keys and declaration names stay in sync. If this test
12069+ fails, update _evals_builtin_tools.py to match.
12070+
12071+ Sandbox tool declarations (provision_sandbox, load_sandbox) are
12072+ intentionally excluded from both the SDK and server AgentConfig
12073+ tool catalogs, so no sync check is needed for them.
1207012074 """
1207112075 # pylint: disable=g-import-not-at-top
1207212076 try :
1207312077 from cloud .ai .platform .evaluation .utils import interaction_converter
1207412078 except ImportError :
12075- pytest .skip ("interaction_converter not available outside google3" )
12079+ pytest .skip (
12080+ "interaction_converter not available outside google3"
12081+ )
1207612082 # pylint: enable=g-import-not-at-top
1207712083
1207812084 # --- Built-in tool types: keys must match ---
@@ -12090,9 +12096,7 @@ def test_catalog_in_sync_with_server(self):
1209012096 for tool_type in server_builtin_keys :
1209112097 server_names = {
1209212098 fd .name
12093- for fd in interaction_converter ._BUILTIN_TOOL_FUNCTION_DECLARATIONS [
12094- tool_type
12095- ]
12099+ for fd in interaction_converter ._BUILTIN_TOOL_FUNCTION_DECLARATIONS [tool_type ]
1209612100 }
1209712101 sdk_names = {
1209812102 fd .name
@@ -12104,17 +12108,14 @@ def test_catalog_in_sync_with_server(self):
1210412108 f" SDK: { sorted (sdk_names )} "
1210512109 )
1210612110
12107- # --- Sandbox declarations: names must match ---
12108- server_sandbox_names = {
12109- fd .name for fd in interaction_converter .sandbox_function_declarations ()
12110- }
12111- sdk_sandbox_names = {
12112- fd .name for fd in _evals_builtin_tools .SANDBOX_DECLARATIONS
12113- }
12114- assert sdk_sandbox_names == server_sandbox_names , (
12115- f"SANDBOX_DECLARATIONS names out of sync.\n "
12111+ # --- Sandbox tool names: SDK names must match server names ---
12112+ server_sandbox_names = set (
12113+ interaction_converter ._SANDBOX_TOOL_NAMES
12114+ )
12115+ assert _evals_builtin_tools .SANDBOX_TOOL_NAMES == server_sandbox_names , (
12116+ f"SANDBOX_TOOL_NAMES out of sync.\n "
1211612117 f" Server: { sorted (server_sandbox_names )} \n "
12117- f" SDK: { sorted (sdk_sandbox_names )} "
12118+ f" SDK: { sorted (_evals_builtin_tools . SANDBOX_TOOL_NAMES )} "
1211812119 )
1211912120
1212012121
0 commit comments