IS_AGENT_ACTIVATED

functionsupportedAccounts, users, sessions, warehouses

docs.snowflake.com ↗

Context functions

Returns the VARCHAR value 'TRUE' if an agent is active in the current execution context, or 'FALSE' if no agent is active.

Syntax

SYS_CONTEXT(
  'SNOWFLAKE$CURRENT' ,
  'IS_AGENT_ACTIVATED'
)

Parameters

NameRequiredDescription
'SNOWFLAKE$CURRENT'requiredSpecifies that you want to call a function to return context information about the current execution context.
'IS_AGENT_ACTIVATED'requiredCalls the IS_AGENT_ACTIVATED function. This function takes no additional arguments and returns whether any agent is active in the current execution context.

Returns

The function returns one of the following VARCHAR values: - 'TRUE' if any agent is active in the current execution context. - 'FALSE' if no agent is active. The function returns 'TRUE' in the following scenarios: - A Snowflake first-party agent is executing the query, including: A named Cortex Agent (data agent) - A stateless lite agent invoked through a Snowflake CoCo client (CLI, Desktop, or web) or the REST API - A query initiated through Snowflake CoWork - An external agent is executing the query, including: An agent that connects to Snowflake through a managed MCP server - A session opened by a SERVICE_AGENT user, which is automatically agent-active - A session using a Snowflake OAuth custom client integration or an External OAuth integration configured with IS_AGENTIC = TRUE - A session created from an OAuth token exchange token with act type agent For an overview of how Snowflake identifies, audits, and governs agent sessions, see Agent identity. To compare this return value against the BOOLEAN value TRUE or FALSE, cast the return value to BOOLEAN. For example: 2026_06 behavior change bundle When the 2026_06 behavior change bundle is enabled in your account and you call this function through SYS_CONTEXT, it returns BOOLEAN instead of the VARCHAR string 'TRUE' or 'FALSE'. Existing casts, such as ::BOOLEAN or ::NUMBER, continue to work unchanged. For the return type of every property and function by namespace, see SYS_CONTEXT return types.

See also