- Categories:
Table functions (Cortex Agents)
GET_ AI_ OBSERVABILITY_ LOGS (SNOWFLAKE.LOCAL)¶
Retrieve log data for an AI Observability event, such as a warning or failure, for a Cortex Agent or an External Agent application (see External Agent commands).
Call this function to retrieve information about what events occurred during an evaluation run. For more information, see Cortex Agent evaluations and Observability data.
Syntax¶
Arguments¶
databaseName of the database containing the agent.
schemaName of the schema containing the agent.
agent_nameName of the agent to retrieve a record for.
agent_typeThe agent type string. Use
CORTEX AGENTfor a Cortex Agent evaluation orEXTERNAL AGENTfor an External Agent object (see External Agent commands). This value is case-insensitive.
Returns¶
For details on the information contained in AI Observability events, see Observability data.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
| Privilege | Object | Notes |
|---|---|---|
| CORTEX_USER | Database role | |
| USAGE | Cortex Agent or External Agent | Required on the object identified by agent_name. For EXTERNAL AGENT, USAGE on the External Agent is sufficient to call this function (MONITOR does not apply). |
| MONITOR | Cortex Agent | Required on the Cortex Agent identified by agent_name when agent_type is CORTEX AGENT. Does not apply when agent_type is EXTERNAL AGENT. |
Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
When agent_type is EXTERNAL AGENT, only USAGE on that object is required to call this function. OWNERSHIP on the External Agent is required to modify or remove the object with ALTER EXTERNAL AGENT or DROP EXTERNAL AGENT.
For the full access control permissions required by Cortex Agent evaluations, see Cortex Agent evaluations – Access control requirements. For External Agent objects, see Observability data.
Examples¶
The following example checks for errors and warnings for a run called run-1, where the agent is named evaluated_agent stored on the schema eval_db.eval_schema: