{"uid":"cap_KcbjuVjVDyBUCfAn_0yT5","slug":"vrsai-sql-preflight-check-b24456d3","name":"vrsai SQL Preflight Check","description":"Check PostgreSQL SQL immediately before execution to prevent destructive or unsafe database changes by AI agents and automated systems.","url":"https://api.vrsai.tech/v1/capabilities/sql_preflight?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object"},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"checks":[{"id":"parse_validity","status":"PASS"},{"id":"statement_count","status":"PASS","evidence":{"count":1}},{"id":"unbounded_delete","status":"BLOCK","reason_code":"DELETE_WITHOUT_WHERE","statement_index":0},{"id":"protected_relation_mutation","status":"BLOCK","evidence":{"relations":[{"name":"customers"}]},"reason_code":"PROTECTED_RELATION_MUTATION","statement_index":0},{"id":"expected_statement_kind","status":"PASS","statement_index":0}],"coverage":{"dialect":"postgresql","assessment_scope":["unbounded_delete","unbounded_update","truncate","destructive_drop","destructive_cascade","alter_table_hazards","nonconcurrent_index","create_extension","protected_relation_mutation","dynamic_or_procedural_sql","expected_statement_kind","multi_statement_evaluation"],"checks_performed":["unbounded_delete","unbounded_update","truncate","destructive_drop","destructive_cascade","alter_table_hazards","nonconcurrent_index","create_extension","protected_relation_mutation","dynamic_or_procedural_sql","expected_statement_kind","multi_statement_evaluation"],"checks_not_performed":["privilege_change","explicit_locking","alter_system","availability_maintenance","external_program_execution","drop_schema_or_database","read_cost_and_row_estimation","sensitive_data_access_and_exfiltration","tenant_isolation","semantic_correctness"],"complete_for_declared_scope":true},"decision":"BLOCK","statements":[{"kind":"DELETE","index":0,"decision":"BLOCK","relations":[{"name":"customers"}],"mutates_data":true,"reason_codes":["DELETE_WITHOUT_WHERE","PROTECTED_RELATION_MUTATION"],"administrative":false,"changes_schema":false,"changes_privileges":false}],"reason_codes":["DELETE_WITHOUT_WHERE","PROTECTED_RELATION_MUTATION"],"machine_action":"DO_NOT_EXECUTE","ruleset_version":"1.0.0","statement_count":1,"input_fingerprint":"v1:4634deedb0970b042098df09e6f8bf365f2ddb635a18742c5ffa676844e4fa62"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.05","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.05/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_cFkn7kiOleAKGOFYAqj87","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.05","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Analyzes PostgreSQL SQL statements before execution to detect and block destructive or unsafe database operations by AI agents","exampleAgentPrompt":"Before you run that DELETE query against the customers table, check it through the SQL preflight validator first — I need to make sure it has a WHERE clause and isn't touching any protected relations.","exampleUseCases":[{"title":"Block unbounded DELETE in agent pipeline","prompt":"I have an AI agent that generates and runs SQL automatically. Before it executes this statement — DELETE FROM customers — can you run it through the SQL preflight check to see if it's safe?"},{"title":"Guard schema migrations from AI mistakes","prompt":"My automated system is about to run a DROP TABLE with CASCADE. Can you preflight that SQL to check whether it triggers any destructive drop or cascade hazards before it goes to the database?"},{"title":"Protect critical tables from AI writes","prompt":"I've marked 'orders' and 'payments' as protected relations. Can you check this UPDATE statement against the preflight API to confirm it won't mutate those tables before we let the agent execute it?"}],"resultDescription":"Returns a structured JSON object with a top-level 'decision' (ALLOW or BLOCK), a 'machine_action' directive (e.g. DO_NOT_EXECUTE), per-statement analysis including kind, relations touched, and reason codes (e.g. DELETE_WITHOUT_WHERE, PROTECTED_RELATION_MUTATION), a list of individual check results with PASS/BLOCK status, coverage metadata showing which checks were performed, and a fingerprint of the input SQL for audit purposes.","failureModes":["Invalid or unparseable SQL returns a BLOCK with parse_validity FAIL check","Missing required 'input' body fields returns a 400-class error","Non-PostgreSQL dialect SQL may not be fully assessed, noted in coverage gaps","Protected relations not specified means that check is skipped","Network timeout if the service is unreachable, requiring retry logic"],"whenToPreferThis":"Choose this endpoint when you need a real-time, pre-execution safety gate specifically for PostgreSQL SQL generated or submitted by AI agents or automated systems. It is purpose-built for agentic pipelines where LLM-generated SQL must be validated before touching production data. Prefer it over generic SQL linters when you need machine-actionable ALLOW/BLOCK decisions, reason codes for audit trails, and coverage of AI-specific risks like unbounded deletes, protected table mutations, and multi-statement hazards.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-13T00:31:44.879Z","isFirstParty":false,"canonicalSlug":"vrsai-sql-preflight-check-f1b3876a"}