Skip to main content

Snowflake Cortex Agent action

The Snowflake Cortex Agent action lets Glean agents ask a natural language question to a Cortex Agent you already manage in Snowflake and return the agent’s answer. Provide the agent’s database, schema, and name, plus the question with business context, filters, and constraints. Snowflake can orchestrate tools such as Cortex Search, Cortex Analyst, and custom tools, then return free-form text, optional tables, and execution updates so you can build a final response in your Glean agent, for example, summarize the answer, post to Slack, or file a ticket.

This is a read action. It calls Snowflake’s Cortex Agents REST API, which may run Cortex Search and text-to-SQL queries over your Snowflake data. The action itself does not modify data; it executes the read operations the configured Cortex Agent performs to answer the question.

Limitations

  • Each run sends one question and returns one response. Use separate runs for follow-up questions.

  • Chart configs, for example, Vega specs are not rendered.

  • There is a timeout risk for long-running agents and Glean steps can time out before the agent finishes.

Prerequisites

  • An admin has enabled and configured the Snowflake Actions action pack in the Glean Admin Console.

  • Snowflake role and permissions

    • A Snowflake role (for example, GLEAN_QUERY_SNOWFLAKE_ROLE) with at least:

      • Database role: SNOWFLAKE.CORTEX_USER or SNOWFLAKE.CORTEX_AGENT_USER.

      • USAGE on the agent’s database, schema, and the agent object itself.

      • USAGE and SELECT on any databases, schemas, and tables referenced by the agent’s semantic models.

      • USAGE (and EXECUTE, if needed) on any stored procedures or UDFs used as custom tools in the agent.

  • Existing Cortex Agent in Snowflake

    • You have already created and tested a Cortex Agent in the target Snowflake account.

    • You know its database, schema, and agent name.

Supported parameters

ParameterTypeRequiredRecommended sourceDescription
QuerystringYesDynamic (user input or step)Natural language question or request for the Cortex Agent. Include business context, filters, and constraints.
DatabasestringYesFixed in step configurationName of the Snowflake database that contains the Cortex Agent.
SchemastringYesFixed in step configurationName of the Snowflake schema that contains the Cortex Agent.
Agent NamestringYesFixed in step configurationName of the Cortex Agent to query (as defined in Snowflake).

Usage example

Scenario: Revenue insights via Cortex Agent

Goal: Let users ask a revenue question and reuse the result in a broader workflow.

Setup in Agent Builder:

  • Add a trigger step, for example, an input form with a query in the text field.

  • Add the Snowflake Cortex Agent action and configure:

    • Query: [[query]]

    • Database: your agent’s database (for example, CORTEX_ANALYST_DEMO).

    • Schema: your agent’s schema (for example, REVENUE_TIMESERIES).

    • Agent name: the agent name (for example, revenue_agent).

  • Add a Respond step that returns the action’s response field.

Resulting behavior:

  • The action sends the user’s question as the query to the configured Cortex Agent, qualified by the database, schema, and its name.

  • The Cortex Agent can interpret time windows, for example, “last quarter”, run Cortex Search, and generate text-to-SQL queries as configured.

  • The action returns the agent’s final answer text and any tabular results, plus execution updates.

Troubleshooting

FAQs