agents/{name}:run REST API, and returns the reply. This guide covers the Snowflake-side setup, the two auth modes, and the registration payload
Prerequisites (Snowflake side)
1
A deployed Cortex Agent
Create the agent in Snowsight or with
CREATE AGENT. Find its fully-qualified name with SHOW AGENTS IN ACCOUNT; you need the database, schema, and agent name2
The account URL
Run
SELECT SYSTEM$ALLOWLIST(); and take the host of type SNOWFLAKE_DEPLOYMENT_REGIONLESS (or SNOWFLAKE_DEPLOYMENT), then prefix https://. Do not use the bare account-locator host; it returns an HTML “File not found” and the call will fail3
Grant the calling role access
Grant the role behind your PAT or key-pair user:
USAGE on the database, schema, and agent; USAGE and READ on the semantic-model stage; USAGE on the warehouse; and SELECT on the tables the agent queries4
Put the warehouse in the agent spec
The Analyst tool runs SQL using the warehouse named in the agent spec’s
tool_resources.<analyst_tool>.execution_environment, not the user’s default warehouse. Set it there or Analyst queries failPAT auth also requires a network policy on the user or account that allows the gateway’s egress IP, or Snowflake rejects the token with error
390432. Key-pair JWT auth does not need a network policy, which is why it is the better choice for a hosted gatewayAuth modes
- PAT (simplest)
- Key-pair JWT (recommended for hosting)
Create a Programmatic Access Token for the calling user. The gateway sends it as
Authorization: Bearer <pat> with X-Snowflake-Authorization-Token-Type: PROGRAMMATIC_ACCESS_TOKEN. Requires a network policy covering the gateway IPRegister the agent
Fields
string
required
The regionless deployment host from
SYSTEM$ALLOWLIST(), with https://string
required
The fully-qualified Cortex agent.
snowflake_agent_name also fills the model template snowflake_cortex_agents/{name}string
default:"pat"
pat or keypair_jwtstring
Required in PAT mode
string
Required in key-pair mode. Private key is an unencrypted PKCS8 PEM