SameerMesiah97 opened a new pull request, #68942: URL: https://github.com/apache/airflow/pull/68942
**Description** This change introduces a new hook for interacting with Snowflake Cortex Agents (`SnowflakeCortexAgentHook`). The hook provides a `run_agent()` method that executes a Cortex Agent using Snowflake's REST API and returns the JSON response payload. It supports conversation threading (`thread_id` and `parent_message_id`), model configuration, agent instructions, orchestration settings, tool selection, and tool resource configuration. A helper method, `get_text_response()`, is also provided to extract text content from Cortex Agent responses. Authentication is delegated to `SnowflakeHook` by reusing connection parameters and access tokens resolved by the existing Snowflake provider infrastructure. **Rationale** Snowflake Cortex Agents provide a programmable interface for interacting with AI agents hosted within Snowflake. While the Snowflake provider currently includes hooks and operators for executing SQL workloads, it does not provide an integration for Cortex Agents. Introducing a dedicated hook establishes the foundation for future Cortex Agent integrations while providing users with a reusable interface for invoking agents from Airflow tasks. This initial implementation is scoped to OAuth authentication by reusing access tokens resolved by `SnowflakeHook`. Support for additional authentication mechanisms can be added in future enhancements. **Tests** Added unit tests verifying that: * `run_agent()` executes a Cortex Agent request and returns the expected response. * Thread identifiers are correctly included in the request payload. * Optional request parameters are included when provided. * A `ValueError` is raised when `thread_id` is provided without `parent_message_id`. * HTTP errors returned by the Cortex Agents API are propagated to the caller. * A `ValueError` is raised when an access token is unavailable. * `get_text_response()` correctly extracts text content from agent responses. **Documentation** Docstrings have been added describing the hook and its public methods, including supported request parameters and response behavior. **Backwards Compatibility** This change is additive only and does not modify existing Snowflake provider functionality or public APIs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
