Skip to content

Add Cortex Agent management methods to SnowflakeCortexAgentHook - #70101

Merged
shahar1 merged 3 commits into
apache:mainfrom
SameerMesiah97:SnowflakeCortexAgentHook-Extension
Sep 19, 2026
Merged

shahar1 merged 3 commits into
apache:mainfrom
SameerMesiah97:SnowflakeCortexAgentHook-Extension

Conversation

@SameerMesiah97

@SameerMesiah97 SameerMesiah97 commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This change extends SnowflakeCortexAgentHook with support for managing Snowflake Cortex Agent Objects.

The hook now exposes methods to describe, list and delete Cortex Agents using the Snowflake Cortex Agent REST API. To support these endpoints, the internal request helper has been updated to accept optional query parameters while continuing to centralize authentication, request execution and error handling.

Rationale

The existing hook supports executing Cortex Agents through run_agent(), but the Snowflake Cortex Agent REST API also provides endpoints for managing Cortex Agent Objects. Exposing these operations through the hook allows users to inspect and manage agents without needing to invoke the REST API directly.

Adding query parameter support to the shared request helper also provides a reusable foundation for additional Cortex Agent management operations in future enhancements.

Tests

Added unit tests verifying that:

  • describe_agent() sends the expected request and returns the API response.
  • list_agents() correctly forwards optional query parameters and returns the list of agents.
  • delete_agent() issues the expected DELETE request, including both values of the if_exists parameter.
  • _request() returns {} for successful empty dict responses.
  • Cortex Agent methods raise when Snowflake returns an unexpected top-level response shape.

@boring-cyborg boring-cyborg Bot added area:providers provider:snowflake Issues related to Snowflake provider labels Jul 19, 2026
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch from ebdbed1 to 1b8cab7 Compare July 24, 2026 20:03
@SameerMesiah97
SameerMesiah97 marked this pull request as ready for review July 24, 2026 21:36
@SameerMesiah97
SameerMesiah97 requested a review from potiuk as a code owner July 24, 2026 21:36
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch from 1b8cab7 to 25b776e Compare July 27, 2026 19:27
@potiuk potiuk added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Jul 28, 2026
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch from 25b776e to 22bfa6a Compare July 28, 2026 21:52
@SameerMesiah97
SameerMesiah97 marked this pull request as draft July 29, 2026 19:34
@SameerMesiah97
SameerMesiah97 marked this pull request as ready for review July 29, 2026 19:34
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch from 784409d to 652bd4c Compare July 29, 2026 19:35
@SameerMesiah97

Copy link
Copy Markdown
Contributor Author

Requesting review for this.

@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch 2 times, most recently from 9dc3357 to 5663c69 Compare August 1, 2026 13:04
@SameerMesiah97
SameerMesiah97 requested a review from shahar1 August 1, 2026 14:13
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch 2 times, most recently from 2a75bae to 8d4802f Compare August 1, 2026 19:43
@vikramkoka

Copy link
Copy Markdown
Contributor

cc: @kaxil
Similar to the other PR conversation

@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch from 8d4802f to e1033c6 Compare August 16, 2026 16:40
@ashb

ashb commented Aug 17, 2026

Copy link
Copy Markdown
Member

Please don't merge this just yet - we are looking at unifying this in to common.ai

@SameerMesiah97

Copy link
Copy Markdown
Contributor Author

Please don't merge this just yet - we are looking at unifying this in to common.ai

I appreciate the heads up. But would it not take a substantial amount of time for the maintainers to align on the final abstraction? There is also a possibility we may decide against it. I wonder if we could let these PRs merge whilst that discussion continues.

@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch 2 times, most recently from e5fe3b1 to 0d5d47e Compare August 23, 2026 17:08
@SameerMesiah97

Copy link
Copy Markdown
Contributor Author

I believe this should be okay to merge without adding support for the additional interface (BaseManagedAgentToolset) introduced in PR #71946. The new interface is related but somewhat tangential to these new hook methods which this PR was submitted. to introduce. Adding say SnowflakeCortexAgentToolset to this PR would be out of scope for so a follow-up PR will be opened to align the the Snowflake Cortex Agent module with the new interface.

@eladkal

eladkal commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Please don't merge this just yet - we are looking at unifying this in to common.ai

@ashb @kaxil please advise next steps here

@SameerMesiah97

Copy link
Copy Markdown
Contributor Author

Please don't merge this just yet - we are looking at unifying this in to common.ai

@ashb @kaxil please advise next steps here

I think @ashb's 'don't merge' comment is a bit outdated now that PR #71946 has landed. My understanding is that the SnowflakeCortexAgentToolset which will be used to take advantage of the interface introduced in PR #71946 might use some of the methods I am introducing in this PR. Essentially, that piece of work will build on this PR (and the other hook and operator related PRs for Snowflake Cortex Agents) rather than something that blocks these PRs until SnowflakeCortexAgentToolset is introduced.

@ashb

ashb commented Aug 29, 2026

Copy link
Copy Markdown
Member

Yes, most likely you are correct,

@eladkal
eladkal force-pushed the SnowflakeCortexAgentHook-Extension branch from 0d5d47e to f9720eb Compare August 29, 2026 14:31
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch from f9720eb to 215f8e3 Compare September 9, 2026 16:13
@SameerMesiah97

SameerMesiah97 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Requesting review for this.

Sameer Mesiah added 3 commits September 16, 2026 14:31
This change extends SnowflakeCortexAgentHook with support for
managing Cortex Agent Objects through the Snowflake REST API.

The hook now supports describing, listing and deleting Cortex
Agents in addition to executing them via run_agent().

The internal request helper has also been enhanced to support
query parameters, enabling endpoints such as list_agents() and
delete_agent() to pass optional REST query parameters while
reusing the existing request implementation.
…lper validate the expected top-level response shape. Remove endpoint-level casts and handle successful empty responses as empty dictionaries for dict-shaped endpoints.
response fallback, improve list response validation, and document
manual pagination through from_name and show_limit.
@SameerMesiah97
SameerMesiah97 force-pushed the SnowflakeCortexAgentHook-Extension branch from 215f8e3 to f421269 Compare September 16, 2026 13:35
@shahar1
shahar1 merged commit f2112c8 into apache:main Sep 19, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:snowflake Issues related to Snowflake provider ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants