Cortex Sandboxes tutorials

These tutorials provide step-by-step instructions for exploring Cortex Sandboxes. They are ordered as a progression — start with the first one and work down.

Your first Cortex Sandbox in Cortex Code

Install the SDK, run your first sandbox, run untrusted code safely, query Snowflake, and fan out across sandboxes — each step generated and run by Cortex Code.

Work with sandboxes using the Python SDK

Run named sandboxes you can reconnect to, start detached tasks, query Snowflake from inside a sandbox, and fan out across many sandboxes in parallel.

Analyze Snowflake data with Cortex AI in a sandbox

Query live Snowflake data and call SNOWFLAKE.CORTEX.COMPLETE in one isolated container using your injected session identity.

Governance enforcement in a sandbox

Demonstrate that column masking and row access policies apply inside a sandbox exactly as they do outside it.

Give a sandbox secure access to an external API

Use a brokered secret and an egress policy to let code in a sandbox call an external API, without the credential ever entering the sandbox.

Run Cortex batch inference over a Snowflake table

Fan out parallel sandboxes to run SNOWFLAKE.CORTEX.COMPLETE on rows from a Snowflake table, with no credential configuration.

Reconnect to a running sandbox

Use Sandbox.connect() and Sandbox.list() to reattach to a running sandbox after a driver restart, and check status, read logs, and wait for a long-running job to complete.

Run a LangGraph agent over Snowflake data in a sandbox

Build a LangGraph StateGraph agent that queries live Snowflake data and calls Cortex AI for reasoning, with governance enforced and egress locked down.