Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Text-to-SQL Data Agent (BigQuery-first)

    1

    Build a "chat with your data" agent that never runs dangerous queries, never surprises you with a warehouse bill, and never states a wrong number with confidence.

    $19

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Text-to-SQL Data Agent (BigQuery-first)

    Text-to-SQL Data Agent (BigQuery-first)

    Example session with this skill installed

    Build the query tool for our 'ask the sales data' agent on BigQuery. Business users will ask things like 'net revenue by region last month'. The sales dataset is 40 TB. Write the tool implementation in query_tool.py and the agent instructions in instructions.md.

    • Read your context and instructions
    • Compiled the text-to-sql data agent

    query_tool.py: run_query(sql, purpose) → sql_guard (single SELECT, allow-list proj.sales.* and proj.ref.*, LIMIT ≤ 1000, warning on unfiltered order_lines) → dry run (refuse above 10 GiB with "add a filter on order_date or use the daily mart") → execute with maximum_bytes_billed=10 GiB, labels app=sql-agent, 120 s timeout → rows + bytes + truncated flag. instructions.md: look up net_revenue in the semantic layer before computing; always filter order_date; exclude test stores; state the period and assumptions; show the SQL and data freshness; never present a truncated result as complete.

    truncated flag. instructions.md

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The hard part of a data agent is not generating SQL — strong models write good SQL. It is knowing what the business means (which table, which metric definition, which filters) and never returning a confident wrong number. This skill makes safety and cost controls structural, not prompt-based.

    What your agent builds with it

    • Semantic layer (YAML template included): curated tables with grain, partition, freshness and pitfalls; canonical metric SQL; safe vs fan-out joins; verified example queries; business calendar.
    • Schema tools instead of pasting the whole schema: search_schema, describe_table, get_metric_definition, run_query.
    • Layered safety and cost control
      1. Read-only service account (the real boundary).
      2. sql_guard.py: exactly one read-only statement, no DML/DDL/EXPORT/scripting or denied functions, table allow-list (CTEs handled), LIMIT enforced or lowered, warnings for SELECT * and unfiltered large tables.
      3. bq_safe_query.py: dry run to estimate bytes and refuse with an actionable message, then execution with maximum_bytes_billed, job labels and a timeout.
      4. Per-user quotas and PII-free curated views.
    • Agent behaviour rules: resolve ambiguity or state assumptions, always use the metric definition, filter on partitions, sanity-check totals and fan-out duplicates, show the SQL and data freshness, never present truncated results as complete.
    • Evaluation: execution-accuracy golden set (not exact SQL match), with ambiguous and unanswerable questions.

    BigQuery-first; the guard works for any sqlglot dialect (Snowflake, Postgres, …).

    Part of the Production AI Agents series. Start free with Agent Architecture; pair with Agent Evals (statistics for your accuracy report) and Agent Guardrails.

    Does not provide a hosted service or UI. The cost-capped runner is BigQuery-specific; for other warehouses you reuse the guard and adapt the execution layer. Generic tool design, eval statistics and policy gating are covered by companion skills.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 day ago

    Requires

    Python 3.10+
    sqlglot
    Python

    Permissions

    Allowed Hosts

    bigquery.googleapis.com (only when you run bq_safe_query.py against your own project)

    File Scopes

    Your
    project
    folder
    (writes
    tool
    code
    semantic
    layer
    instructions
    and
    eval
    set)

    The SQL guard runs locally with no network access. BigQuery is only contacted with your own credentials when you run the query helper.

    Listed1 day ago

    What's inside

    Frequently Asked Questions

    Yes for the SQL guard and the design (any sqlglot dialect, e.g. Snowflake or Postgres). The dry-run and byte-cap runner is BigQuery-specific.

    No. The read-only service account is the boundary. The guard, dry run and byte cap are additional layers that make failures cheap and give the model actionable errors.

    With execution accuracy: run predicted and reference SQL and compare result sets. The skill explains how to build the golden set, including ambiguous and unanswerable questions.

    New in Security