Skip to content
Lucas Lessa
Voltar para as notícias
SnowflakeGAImpacto: Alto

Python Code Execution Tool in Snowflake Cortex Agents

Cortex Agents now feature a native tool to execute Python code in an isolated environment, allowing agents to process data and generate charts during chats.

O que mudou

The code execution tool enables agents to safely run Python scripts to perform calculations, process data, and create visualizations during an interaction. The environment runs in an isolated sandbox with access only to the current session data and a mounted workspace stage.

Use cases

Imagine you need an agent to process complex data and generate a chart based on query results.

  • Run Python scripts on-demand during a chat conversation.
  • Process data and perform mathematical or statistical calculations.
  • Generate visualizations and charts using popular libraries.

How to use

Configure the tool in your agent specification by including the type and corresponding resources.

tools:
  - tool_spec:
      type: code_execution
      name: code_execution

tool_resources:
  code_execution:
    permission_policy:
      type: always_ask

What happens in this code:

  1. Defines the inclusion of the simple code execution tool (code_execution) in the agent's tools list.
  2. Configures the sandbox permission policy to always_ask, requiring user approval before executing state-modifying tools.

Limitations and requirements

  • Stage: General Availability (GA).
  • The execution environment uses Python 3.12 with common pre-installed libraries such as numpy, pandas, scipy, pyarrow, matplotlib, and plotly.
  • Calls to agents using owner's rights do not support code execution; use caller's rights instead.
  • The sandbox is scoped to a single conversation thread, and in-memory state does not persist between separate executions.
Ver nota oficial do Snowflake

October 5, 2026: Cortex Agent code execution tool (General availability)

Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.

Relacionadas