- Categories:
Context functions (General)
IS_ AGENT_ ACTIVATED (SYS_ CONTEXT function)¶
Returns the VARCHAR value 'TRUE' if an agent is active in the current execution context.
Syntax¶
Check whether any agent is active:
Check whether an agent of a specific type is active:
Check whether a specific Snowflake Intelligence agent is active:
Arguments¶
'SNOWFLAKE$CURRENT'Specifies that you want to call a function to return context information about the current execution context.
'IS_AGENT_ACTIVATED'Calls the IS_AGENT_ACTIVATED function.
'agent_type'Optional. Specifies the type of agent to check. If you don’t specify an agent type, the function checks whether any agent is active.
You can specify one of the following values:
Agent type Description SNOWFLAKE_INTELLIGENCEA Snowflake Intelligence agent. CORTEX_CODE_CLIA Cortex Code CLI client. CORTEX_CODE_DESKTOPA Cortex Code Desktop client. CORTEX_CODE_SNOWSIGHTA Cortex Code UI (Snowsight) client. Only
SNOWFLAKE_INTELLIGENCEsupports the optionaldatabase,schema, andnamefilter arguments.'database'Specifies the database component of the agent’s fully qualified name.
Supported only when
agent_typeis'SNOWFLAKE_INTELLIGENCE'.'schema'Specifies the schema component of the agent’s fully qualified name.
Supported only when
agent_typeis'SNOWFLAKE_INTELLIGENCE'.'name'Specifies the name of the agent.
Supported only when
agent_typeis'SNOWFLAKE_INTELLIGENCE'.
Returns¶
The function returns one of the following VARCHAR values:
'TRUE'if an agent matching the specified criteria is active in the current execution context.'FALSE'if no matching agent is active.
To compare this return value against the BOOLEAN value TRUE or FALSE, cast the return value to BOOLEAN. For example:
Usage notes¶
-
When you specify
'SNOWFLAKE_INTELLIGENCE'as the agent type, you can optionally provide the database, schema, and name arguments to match a specific agent. Other agent types don’t support these filter arguments. -
To simulate the result of this function in a policy, use the
SNOWFLAKE$CURRENT_ACTIVATED_AGENT_TYPESlist argument with the POLICY_CONTEXT function.
Examples¶
The following example checks whether any agent is active in the current execution context:
The following example checks whether a Snowflake Intelligence agent is active:
The following example checks whether a specific Snowflake Intelligence agent is active by its fully qualified name: