debug-single-query-for-cortex-agent

Debug Cortex agent query failures through structured trace analysis and fix deployment.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/randoneering/nix-flake-mirror --skill debug-single-query-for-cortex-agent
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: debug-single-query-for-cortex-agent
Source: https://github.com/randoneering/nix-flake-mirror/tree/main/home/programs/opencode/skills/snowflake/agent_optimization/debug-single-query-for-cortex-agent
Command: npx skills add https://github.com/randoneering/nix-flake-mirror --skill debug-single-query-for-cortex-agent

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, snowflake-connector-python, pandas, urllib3, trulens, and includes scripts (resource) components.

What problem does it solve?

Interactively debug Cortex agent query failures to identify routing, SQL, or response issues. Use when investigating why a specific query fails or produces incorrect results.

Core Features & Use Cases

  • Guided, multi-step debugging workflow covering context establishment, retrieval of the failing query, live trace analysis, and safe application of fixes via agent orchestration.
  • Supports debugging production and development runs, including fetching event traces, inspecting tool usage, and validating fixes with re-tests.
  • Use Case: When a Cortex agent returns an incorrect answer, follow the interactive steps to reproduce, isolate whether routing, SQL, or model logic is at fault, and implement a controlled change with traceable versioning.

Quick Start

Initiate an interactive debugging session for a failing Cortex agent query and follow the steps to reproduce, analyze, and apply a fix.

Frequently Asked Questions about debug-single-query-for-cortex-agent

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a Cortex agent query that returns incorrect results?▼

To debug a Cortex agent query, use a structured workflow to establish context, retrieve the failing query, analyze live traces, inspect tool usage, and apply safe fixes. This isolates routing, SQL, or model logic faults end-to-end.

Why does my Cortex agent fail to route queries correctly?▼

Cortex agent routing failures are diagnosed by fetching event traces and inspecting tool configurations during a live trace analysis. This workflow identifies whether the routing mechanism, SQL generation, or model logic is the root cause.

What is the best way to trace SQL execution issues in a Snowflake Cortex agent?▼

Tracing SQL execution issues in a Snowflake Cortex agent involves retrieving the failing query, analyzing event traces, and inspecting tool usage. This process isolates SQL generation faults from routing or response logic errors.

Can I debug production Cortex agent runs without disrupting the agent lifecycle?▼

Yes, you can debug production Cortex agent runs by fetching event traces and inspecting tool usage. Fixes are validated with re-tests and applied via controlled changes with traceable versioning to ensure safe deployment.

Do I need pandas and trulens to troubleshoot Cortex agent traces?▼

You need pandas, trulens, requests, and snowflake-connector-python to execute this Cortex agent troubleshooting workflow. These dependencies enable query retrieval, trace analysis, and tool configuration inspection.

How to reproduce and fix a failing Cortex agent query step by step?▼

Reproduce and fix a failing Cortex agent query by following a multi-step process: establish context, retrieve the query, perform trace analysis, check tool configuration, and safely deploy a controlled fix with traceable versioning.