Airflow Summit 2026 is coming August 31 - September 2 in Austin, TX. Register now to secure your spot!

SnowflakeCortexAgentOperator

Use the SnowflakeCortexAgentOperator to execute Snowflake Cortex Agents.

The operator wraps the Snowflake Cortex Agent Run API and executes an existing Cortex Agent. It returns the JSON response payload from the agent, allowing responses to be consumed by downstream Airflow tasks through XCom.

Prerequisite Tasks

To use this operator, you must do a few things:

Using the Operator

Use the snowflake_conn_id argument to specify the connection used. If not specified, snowflake_default will be used.

An example usage of the SnowflakeCortexAgentOperator is as follows:

tests/system/snowflake/example_snowflake_cortex_agent.py[source]

run_agent = SnowflakeCortexAgentOperator(
    task_id="run_agent",
    database="DEFAULT_DATABASE",
    schema="DEFAULT_SCHEMA",
    agent_name="default_agent",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What can you help me with?",
                }
            ],
        }
    ],
)

Note

Parameters passed to the operator take precedence over the corresponding values configured in the Airflow connection metadata, such as database, schema and role.

Was this entry helpful?