Cortex Agents get a sandbox by default (Pending)

Note

This behavior change isn’t part of a behavior change bundle.

This change applies to Cortex Agents called from CoWork and from the Cortex Agents API. Before it, an agent got a sandbox only if its agent specification included the code_execution tool. Agents without that tool couldn’t run code, read or write files, or install packages. Agents that use the code_toolset_all tool type always had a sandbox, and this change doesn’t affect them.

With this change, every Cortex Agent request gets a sandbox, whether or not the agent specification includes code_execution. The sandbox gives the agent the same tools it has today when code_execution is enabled, including bash, file read and write, search, and Python.

Whether the sandbox can read and write the user’s default workspace depends on how you call the agent and whether the agent has the code_execution tool:

How the agent is calledAgent specification or request has code_executionAgent specification or request has no code_execution
CoWork (including Agent Studio and Slack)No change: sandbox and user workspace.Sandbox and user workspace read/write (new).
Cortex Agents API (including MCP and SQL function calls)No change: sandbox and user workspace. Set mount_user_default_workspace: false in sandbox_config to remove workspace access.Sandbox only, with no user workspace (new). Set mount_user_default_workspace: true in sandbox_config to add workspace access.

On the Cortex Agents API, mount_user_default_workspace takes precedence over the code_execution tool: true mounts the workspace and false doesn’t, whether or not the agent has code_execution. The workspace is mounted only if the API request also includes a thread ID.

Timeline

  • December 9, 2026: Sandbox by default takes effect for accounts that haven’t opted out.
  • December 9, 2026 – February 20, 2027: You can opt out to keep the previous behavior while you validate your agents.
  • February 20, 2027: The opt-out is removed, and every account gets a sandbox by default.

Opting out

The account parameter CORTEX_AGENT_SANDBOX_DEFAULT_ON controls this behavior. To keep the previous behavior until the opt-out ends, an account administrator runs:

ALTER ACCOUNT SET CORTEX_AGENT_SANDBOX_DEFAULT_ON = FALSE;

While the parameter is FALSE, agents get a sandbox only when their specification includes code_execution, as before, and Snowflake ignores sandbox_config.

You can change the parameter at any time during the opt-out period, and the new value applies to the next request:

  • Opting out after adding sandbox_config: Agents keep their sandbox_config, but Snowflake ignores it, and creating or altering an agent with sandbox_config fails. Agents with code_execution install packages from the artifact repositories set under code_execution.
  • Opting back in: Agents get a sandbox by default again, and any sandbox_config saved in their specifications applies again. Its artifact_repositories list, including an empty list, replaces the repositories set under code_execution.

New sandbox_config section in the agent specification

The agent specification has a new top-level sandbox_config section. It holds sandbox settings that used to live under the code_execution tool:

sandbox_config:
  mount_user_default_workspace: true
  artifact_repositories:
    - SNOWFLAKE.SNOWPARK.PYPI_SHARED_REPOSITORY

For a description of each key, see The sandbox_config section.

Precedence is per field: a field that’s set in sandbox_config, including an empty artifact_repositories list, overrides the same field under code_execution. The code_execution tool is still supported for backward compatibility; add new sandbox settings to sandbox_config.

Examples

Keep the previous behavior (opt out). An account administrator sets CORTEX_AGENT_SANDBOX_DEFAULT_ON to FALSE. An agent without code_execution gets no sandbox, as today, and sandbox_config is ignored.

A CoWork agent without code_execution. The agent gets a sandbox with read and write access to the user’s workspace, so it can generate files and use user skills. You don’t need to change the agent specification.

A Cortex Agents API agent with code_execution that shouldn’t use the user’s workspace. Add the following to the agent specification. The agent keeps its sandbox but no longer mounts the workspace:

sandbox_config:
  mount_user_default_workspace: false

A Cortex Agents API agent without code_execution that needs the user’s workspace. Add the following to the agent specification, and include a thread ID in each request:

sandbox_config:
  mount_user_default_workspace: true

What you might need to do

  • Review agents that don’t specify code_execution. They now have a sandbox with tools such as bash, file read and write, and Python. Check that your agent instructions and tool choices still work the way you expect.
  • Pass a thread ID when you call an agent through the Cortex Agents API and want the user workspace mounted. Without a thread ID, the workspace isn’t mounted.
  • Move artifact repository settings to sandbox_config if you want a single place for sandbox settings. Settings in sandbox_config take precedence over the code_execution tool.

Existing sandbox limitations still apply. See Known limitations.

Ref: 2470