Skip to content

Add SnowflakeCortexAgentOperator to Snowflake Provider#69939

Open
SameerMesiah97 wants to merge 1 commit into
apache:mainfrom
SameerMesiah97:SnowflakeCortexAgentOperator
Open

Add SnowflakeCortexAgentOperator to Snowflake Provider#69939
SameerMesiah97 wants to merge 1 commit into
apache:mainfrom
SameerMesiah97:SnowflakeCortexAgentOperator

Conversation

@SameerMesiah97

Copy link
Copy Markdown
Contributor

Description

This change introduces a new SnowflakeCortexAgentOperator for executing Snowflake Cortex Agents from Airflow DAGs.

The operator delegates to the existing SnowflakeCortexAgentHook, providing a declarative interface for invoking Cortex Agents with support for Airflow templating and XCom.

Rationale

SnowflakeCortexAgentHook already exposes the Snowflake Cortex Agent Run API, but users currently need to invoke it from custom Python tasks. This operator promotes that functionality to a first-class Airflow task, making Cortex Agent execution consistent with other operators in the Snowflake provider and enabling it to be composed naturally within DAGs.

Tests

Added unit tests verifying that:

  • SnowflakeCortexAgentOperator correctly delegates execution to SnowflakeCortexAgentHook.run_agent.
  • The response returned by the hook is propagated by the operator.

Example DAG

Added a new example DAG, example_snowflake_cortex_agent, demonstrating how to execute a Snowflake Cortex Agent using SnowflakeCortexAgentOperator.

Documentation

Added documentation for SnowflakeCortexAgentOperator, including its supported parameters and a usage example.

Backwards Compatibility

This is a new operator and does not modify existing functionality. No breaking changes are introduced.

@boring-cyborg boring-cyborg Bot added area:providers kind:documentation provider:snowflake Issues related to Snowflake provider labels Jul 15, 2026
@SameerMesiah97

Copy link
Copy Markdown
Contributor Author

This depends on PR #69731 being merged first. Please do not review this until that happens.

@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentOperator branch 3 times, most recently from 77fc8f0 to e052ae4 Compare July 17, 2026 19:10
@SameerMesiah97
SameerMesiah97 marked this pull request as ready for review July 17, 2026 20:15
@SameerMesiah97
SameerMesiah97 requested a review from potiuk as a code owner July 17, 2026 20:15
@SameerMesiah97
SameerMesiah97 marked this pull request as draft July 18, 2026 09:04
…ents

using SnowflakeCortexAgentHook. Add unit tests, documentation, and an
example DAG demonstrating how to invoke a Cortex Agent from an Airflow DAG.
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentOperator branch from e052ae4 to d42e7ef Compare July 18, 2026 13:28
@SameerMesiah97
SameerMesiah97 marked this pull request as ready for review July 18, 2026 19:53
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 20, 2026
from functools import cached_property
from typing import TYPE_CHECKING, Any

from airflow.models import BaseOperator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use here the compatibility shim?
from airflow.providers.common.compat.sdk import BaseOperator

``snowflake_default``.
"""

template_fields: Sequence[str] = ("messages",)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider adding database/schema/agent_name to template_fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers kind:documentation provider:snowflake Issues related to Snowflake provider ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants