Skip to main content
Preview This guide sets up a Snowflake Cortex Agent that answers business questions with your team’s metrics. Before it writes any SQL, the agent reads the released metric definitions and saved queries from a Metrics Studio workspace. It then runs one read-only query in Snowflake and shows you the SQL it ran. Each person who uses the agent signs in to Atlan with their own account, so the agent sees only the workspaces that person can read.

Before you begin

In Snowflake
  • External MCP connectors for Cortex Agents are enabled on your account. Your Snowflake account team turns these on.
  • A role that can create integrations, such as ACCOUNTADMIN, for the connection step.
  • A database and schema to hold the MCP server, the SQL procedure, and the agent.
  • A warehouse for the agent’s SQL.
In Atlan
  • A workspace with at least one released metric. See Build your first metrics.
  • That workspace’s ID. In Metrics Studio, open any metric and choose Technical details to see the Workspace ID.
  • Every person who will use the agent has an Atlan account that can read the workspace.
Data
  • The people using the agent can SELECT from the tables your metrics read. The agent runs SQL with their Snowflake role, not with Atlan’s access.
1

Connect Snowflake to Atlan

Create the API integration and the external MCP server that point at Atlan MCP Gateway, then grant the users’ role USAGE on both. Follow Connect Snowflake agents to Atlan, then come back here.Both grants are required. Without either one, the agent can’t see Atlan’s tools.
2

Create a read-only SQL procedure

The agent needs a tool to run the SQL it writes. Create this procedure in your database and schema:
The procedure runs with the caller’s rights and returns at most 500 rows. Its check rejects anything but a single SELECT or WITH statement, but that check guards against mistakes, not misuse. What keeps the agent read-only is the role: give the people using it a role with SELECT on the tables your metrics read, and nothing more.
3

Create the agent

In Snowsight, go to AI & ML → Agents and create an agent:
  • Model: Auto.
  • MCP connector: the Atlan MCP server from the first step.
  • Custom tool:
Don’t add Web Search, code execution, or Cortex Analyst. They give the agent other ways to answer that skip your metrics.
4

Add orchestration instructions

Paste the following into the agent’s orchestration instructions. Replace the three placeholders in the first paragraph: what the agent answers questions about, the workspace name, and the workspace ID.
The instructions name tools by what they do. In Atlan MCP Gateway they are mcp__initialise, extension__metric__search_metrics, extension__metric__search_queries, and registry__get_artifact. If Snowsight lists them under other names, use the names it shows.
5

Add response instructions

Paste this into the agent’s response instructions:
Showing the SQL and the artifact IDs lets anyone check an answer against the metric in Metrics Studio.
6

Grant access to the people using the agent

Run these for each role that will use the agent:
The role also needs the two USAGE grants on the Atlan integration and MCP server from the first step.
7

Sign in to Atlan

The first time each person asks the agent a question, Snowflake opens Atlan’s sign-in and consent page. They sign in with their own Atlan account. From then on, the agent reads Atlan with that person’s access.

Verify

Ask the agent a question that one of your released metrics answers, for example “What was average order value last month?”
  • The agent’s tool calls run in this order: initialise, metric search with your workspace ID, get artifact, then run_sql.
  • The answer leads with the number, shows the SQL it ran, and lists the artifact IDs it used.
  • The formula and filters in that SQL match the metric’s Overview in Metrics Studio.
If the agent reads a different version than the one showing Live in Studio, see An agent reads an old version.

Troubleshoot