Skip to main content
v2

Example 4 - Semantic Query (Zapper)

This example completely validates your text-to-SQL architecture end-to-end utilizing the robust 2-Agent Pipeline (db.semantic.interpretdb.semantic.query).

What this validates

This example validates your full semantic runtime capability: intent routing, semantic interpretation, automatic clarifications, schema retrieval, read-only SQL compilation, parameterized execution, policy guardrails, and final text summarization.

Pipeline Architecture

Semantic Query End-to-End

Intent -> planner -> interpret -> query -> postgres -> final answer

React Flow mini map
Turn 0 - User
Hi
Turn 0 - Assistant
intent: GREETINGstate: IDLE
Hi, how can I help you today?
Turn 1 - User
/sql2 show all disconnect requests where status went from 810 to 120 on march 12
Turn 1 - Assistant
intent: SEMANTIC_QUERYstate: COMPLETED
Found 7 disconnect requests where transition 810 -> 120 occurred on March 12.
Turn 2 - User
Why did request ZPR1003 fail?
Turn 2 - Assistant
intent: SEMANTIC_QUERYstate: COMPLETED
Request ZPR1003 failed due to a missing downstream disconnect order ID.
Turn 3 - User
Show billbank record for disconnect id ZPDISC7003.
Turn 3 - Assistant
intent: SEMANTIC_QUERYstate: COMPLETED
Found 1 matching billbank record for disconnect id ZPDISC7003. Record status is CLOSED with a pending amount of 0.00.
Turn 4 - User
Delete from zp_disco_request where account_id='UPSA100'
Turn 4 - Assistant
intent: SEMANTIC_QUERYstate: FAILED
I cannot execute that. The semantic querying system only allows read-only (SELECT) operations.

Testing Catalog

Use the following catalog to test the semantic boundaries and guardrails of the system.

Semantic Query Test Prompt Catalog

Core retrieval

  1. show disconnect requests for account UPSA100
  2. show request status for ZPR1003
  3. show downstream status for DON9001
  4. show billbank record for disconnect id ZPDISC7003
  5. show account status and billing cost for ACMA200

Failure / RCA (Diagnostics)

  1. why did DON9001 fail
  2. show failed or inventory_error requests
  3. show requests where disconnect id is missing
  4. show failed downstream checks for DON9001
  5. show failure reason for request ZPR1003

Join-heavy analytics

  1. show requestId, accountId, requestStatus, downstreamStatus, teamNotes for UPSA100
  2. show requests with downstream status and billbank record status
  3. show requests with UI notes containing inventory
  4. show submitted requests with no billbank disconnect id
  5. show billbank gaps with request and order details

Time-window tests

  1. show disconnect requests between 2026-02-28 and 2026-03-01
  2. show requests after 2026-03-01T00:00:00Z
  3. show checks executed on 2026-03-01
  4. show latest 3 disconnect requests
  5. show requests in last 24 hours

Aggregation / metrics

  1. count disconnect requests by requestStatus
  2. count downstream orders by downstreamStatus
  3. show failed_disconnect_count
  4. show pending_disconnect_count
  5. show billbank_gap_count

Negative Guardrail tests (Should Block)

  1. delete from zp_disco_request where account_id='UPSA100'
  2. update zp_disco_request set request_status='FAILED'
  3. drop table zp_disco_request
  4. show from unknown_entity
  5. show random_field from DisconnectRequest