<!-- Vericto setup prompt: SDK / Runtime API, version 2 (2026-10-18). https://vericto.com/setup/sdk.md -->
Values in angle brackets (<database_id>, <workspace_name>, ...) come from the Vericto dashboard: ask the user for them, or copy this prompt from Dashboard → Integrations → Set up with AI, where they are filled in.

You are adding the Vericto SDK to this application so every SQL statement is checked before the driver runs it, for the database "<database_name>" (<dialect>) in the Vericto workspace "<workspace_name>".
The SDK is a thin client of the Vericto Runtime API: BLOCKED statements are rejected before they reach the database, FLAGGED ones run and are reported, and statements that touch masked columns run as the masked rewrite.

Start by checking what is already in place, then only do what is missing or broken. Do not redo steps that already pass.

MCP servers you may have:
- vericto-account (support, read-only): setup_status, explain_block, search_docs.
- vericto (runtime): check_sql, list_rules, show_rule.
If vericto-account is not connected, inspect the repository instead and ask me to confirm anything you cannot see.

Values (not secrets): VERICTO_DATABASE_ID = <database_id>, VERICTO_API_URL = https://api.vericto.com, dialect = <dialect>.
Secrets: the API key is ALWAYS read from the environment variable VERICTO_API_KEY (from our secret manager in deployed environments). Never ask me to paste it, never print it, never commit it, never put it in a .env file that is tracked by git.

Step 1 - Check current state.
Find the language and the database driver: Node (snowflake-sdk, better-sqlite3, LangChain.js, or another driver) or Python (snowflake-connector-python, sqlite3, SQLAlchemy, any DB-API driver such as psycopg, LangChain, LlamaIndex). Check whether @vericto/sdk (package.json) or vericto (requirements / pyproject) is already installed and where queries are executed. If vericto-account is connected, call setup_status with database_id=<database_id> and report whether Runtime API events already arrive for this database.

Step 2 - API key (a human does this).
If VERICTO_API_KEY is not configured for this service, ask me to create a key in https://app.vericto.com/dashboard/api-keys with only the scope proxy:evaluate and to store it in our secret manager as VERICTO_API_KEY. One key per service, so its events and any agent access allowlist identify this service. Wait for me to confirm.

Step 3 - Install.
Node (18+): npm install @vericto/sdk@0.2.2
Python (3.10+): pip install "vericto==0.3.2", with the extra for the driver: vericto[snowflake], vericto[sqlalchemy], vericto[langchain] or vericto[llamaindex]. sqlite3 and generic DB-API need no extra.
Set VERICTO_DATABASE_ID=<database_id> and VERICTO_API_URL=https://api.vericto.com in the service configuration (not secrets).

Step 4 - Wrap the driver at the single place where the connection is created.
Node:
  snowflake-sdk:  import { guardConnection } from '@vericto/sdk/snowflake'; const conn = await guardConnection(raw);
  better-sqlite3: import { guardDatabase } from '@vericto/sdk/better-sqlite3'; const db = await guardDatabase(new Database(path));
  LangChain.js:   import { VerictoSqlDatabase, VerictoSqlToolkit } from '@vericto/sdk/langchain'
  any driver:     import { Vericto, sqlToExecute } from '@vericto/sdk'; const vericto = new Vericto(); (one per process)
                  const verdict = await vericto.enforce(sql, '<dialect>'); await pool.query(sqlToExecute(verdict));
Python:
  Snowflake:  import vericto.snowflake; conn = vericto.snowflake.connect(...same arguments...)  (or vericto.snowflake.wrap(conn))
  sqlite3:    import vericto.sqlite; conn = vericto.sqlite.connect("app.db")
  SQLAlchemy: import vericto.sqlalchemy; vericto.sqlalchemy.instrument(engine)
  DB-API:     import vericto; conn = vericto.wrap(psycopg.connect(...), dialect="<dialect>")
Always execute the SQL the SDK returns (the masked rewrite when there is one), never the original. Do not wrap the same connection twice. Show me the diff before applying it.

Step 5 - Verify (nothing is executed).
Add a temporary script or test that evaluates the probe without running it:
  Node:   try { await new Vericto().enforce('DELETE FROM vericto_setup_probe', '<dialect>'); } catch (e) { /* VerictoBlockedError: print e.verdict and e.suggestedFix */ }
  Python: from vericto import Vericto, VerictoBlocked
          try: Vericto().enforce("DELETE FROM vericto_setup_probe", "<dialect>")
          except VerictoBlocked as exc: print(exc.verdict.rule_code, exc.suggested_fix)
Expected: blocked (missing WHERE). If it is FLAGGED, the workspace is in observe mode: tell me. A VerictoConfigError means a wrong key, scope or database id: fix configuration, do not switch to fail-open. This counts one Runtime API evaluation. Then call vericto-account.explain_block on the event and summarise it. Remove the temporary script.

Step 6 - Fail mode and enforce (I decide).
The SDK fails closed by default (VERICTO_FAIL_MODE=closed: if Vericto cannot answer, the statement does not run). Explain the trade-off and leave it closed unless I ask otherwise. Do not change the workspace's enforcement mode yourself.

Finish with a checklist: key, install, wrap point(s), probe result, fail mode.
