# AskDB > Open-source NL-to-SQL toolkit for developers. Your LLM generates schema-grounded SQL; your app runs it. AskDB is a library, not a service. `ask({ question, schema, model, dialect })` from `@askdb/core` takes a schema artifact and a Vercel AI SDK `LanguageModel`, and returns SQL that has passed heuristic checks. The same pipeline powers the `askdb` CLI, the `@askdb/client` library, `@askdb/http-api`, and Studio. Get these right before you write code: - **AskDB returns SQL and never executes it.** The host application runs the SQL through its own connection. - **The SQL checks are heuristics, not a security boundary.** They catch common model mistakes and can miss things. The boundary is the database role that runs the SQL: read-only, and with row-level security when the schema is multi-tenant. See [Safety boundaries](https://askdb.tools/concepts/safety-boundaries.md). - **Tenant scope comes from the host application.** AskDB validates the scope's shape, binds the tenant IDs and runs heuristic checks, but it never originates a scope and isn't the enforcement boundary. Sensitive-field handling is the host application's responsibility too. See [Enforce tenancy in the database](https://askdb.tools/guides/enforce-tenancy-in-the-database.md) for Postgres row-level security. - **Wiring the AI model is a choice between two first-party paths.** Either config-driven `@askdb/client`/`@askdb/ai` (built-in providers; install the matching `@ai-sdk/*` package), or a raw Vercel AI SDK model passed to `ask()`. Who owns provider config in the host app decides it. See [Bring your own model](https://askdb.tools/guides/bring-your-own-model.md). Every page has a Markdown version at its URL with the trailing slash replaced by `.md`: `https://askdb.tools/guides/embed-in-node/` is also `https://askdb.tools/guides/embed-in-node.md`. The home page's is `https://askdb.tools/index.md`. The task links below go to those versions. For a project-onboarding map written specifically for coding agents implementing AskDB elsewhere, read [AGENTS.md](https://askdb.tools/AGENTS.md) first. The docs site is organized as Start (overview, quickstart, chart your first answer (an experimental tutorial), find the right tables (the RAG tutorial), install, Studio tour); Guides, in five groups: Build (embed in a Node app, enrich your schema, introspect without a connection, bring your own model, switch engines, connect to SQL Server, RAG for large schemas, rerun a query with new values, chart a query result (experimental), bundle an app), Run in production (run safely, cap the rows a query returns, keep sensitive columns out of prompts, match your server's string settings, deploy as an HTTP service, enable Studio execute), Tenancy (scope queries to a tenant, tenant hierarchies, enforce tenancy in the database), Maintain (upgrade AskDB, fix common errors) and Integrations (Prisma, expose AskDB as an agent tool); Concepts (how AskDB works, the schema artifact, safety boundaries, modes and dialects, privacy model, chart planning (experimental), tenant isolation); and Reference (CLI, HTTP API, configuration, Studio, the schema artifact and tenant policy formats, the SQL checks, packages, the upgrade notes by release, and the core, client, client/charts (experimental), config, ai, rag and introspection APIs). The documentation sets below hold every page, whole and by section. ## Common tasks - [Try AskDB with the CLI](https://askdb.tools/quickstart.md): Create a small SQLite database, point AskDB at it, ask a question in plain English, and run the SQL that AskDB returns. - [Choose which AskDB packages to install](https://askdb.tools/install.md): Choose the AskDB packages for your use case. - [Embed AskDB in a Node app](https://askdb.tools/guides/embed-in-node.md): Add natural-language SQL to a TypeScript service: get checked SQL from AskDB, then run it through your own PostgreSQL, MySQL, SQLite or SQL Server driver. - [Bring your own model](https://askdb.tools/guides/bring-your-own-model.md): Use OpenAI, Anthropic, Azure OpenAI, Google — any provider that speaks the Vercel AI SDK interface. Your key, your billing. - [Enrich the schema artifact](https://askdb.tools/guides/author-your-schema.md): Use Studio to enrich your introspected schema with descriptions, aliases, concepts, sensitive markers, and tenant policy. - [Scope queries to a tenant](https://askdb.tools/guides/multi-tenancy.md): Declare your schema's tenancy in a tenant policy, pass each caller's tenant scope to ask(), and run the SQL with the tenant IDs bound. - [Enforce tenancy in the database](https://askdb.tools/guides/enforce-tenancy-in-the-database.md): Make Postgres the tenant boundary for the SQL AskDB generates: row-level security keyed on a per-request setting, set with SET LOCAL in the transaction that runs the query. - [Use RAG for a large schema](https://askdb.tools/guides/rag-for-large-schemas.md): When your schema is too big to fit in a prompt, index it with @askdb/rag and retrieve only the relevant chunks per question. - [Deploy AskDB as an HTTP service](https://askdb.tools/guides/deploy-as-http-service.md): Stand up @askdb/http-api so any client that speaks HTTP, such as Python, a browser or an agent, can ask questions. - [Expose AskDB as an agent tool](https://askdb.tools/guides/integrations/agents-mcp.md): Wrap the AskDB library or HTTP API as a tool an agent can call, with the tenant scope and SQL execution kept in your host. - [Run AskDB safely in production](https://askdb.tools/guides/run-safely-in-prod.md): The operator checklist for AskDB: read-only roles, statement timeouts, row limits, audit logging, and approval flows. - [Fix a common error](https://askdb.tools/guides/troubleshooting.md): Find the error AskDB shows and fix it: a missing config or API key, a schema that won't load, SQL a check rejects, Studio execute, tenant scope and RAG. - [Upgrade AskDB](https://askdb.tools/guides/upgrading.md): Move your app to a newer AskDB release: upgrade the packages in one step, apply each release's upgrade notes oldest first, and check the result. - [Look up `ask()`'s options and result](https://askdb.tools/reference/core-api/ask.md): ask() options and result, how to run the SQL it returns, the verdict of its checks, modes, and the lower-level functions ask() is built from. - [Look up a CLI command or flag](https://askdb.tools/reference/cli.md): Every askdb command and flag — init, introspect, enrich, studio, bundle, ask, rag. - [Look up an `askdb.config.ts` key](https://askdb.tools/reference/config.md): Every askdb.config.ts key, with its type and default, the environment variables askdb init writes, and how a setting's value is decided. ## Documentation Sets - [Abridged documentation](https://askdb.tools/llms-small.txt): a compact version of the documentation for AskDB, with non-essential content removed - [Complete documentation](https://askdb.tools/llms-full.txt): the full documentation for AskDB - [Start](https://askdb.tools/_llms-txt/start.txt): the overview, the Quickstart tutorial, the chart tutorial (experimental), the RAG tutorial, the install options and the Studio tour - [Guides](https://askdb.tools/_llms-txt/guides.txt): the how-to guides: build, run in production, tenancy, maintain and integrations - [Concepts](https://askdb.tools/_llms-txt/concepts.txt): the explanation pages: how AskDB works, the schema artifact, safety boundaries, modes and dialects, the privacy model and tenant isolation - [Reference](https://askdb.tools/_llms-txt/reference.txt): the CLI, the HTTP API, configuration, the formats, the SQL checks, the packages and every API ## Notes - The complete documentation includes all content from the official documentation - The content is automatically generated from the same source as the official documentation ## Optional - [Schema enrichment skill](https://askdb.tools/skills/askdb-enrich-schema/SKILL.md): a skill for an agent that enriches a freshly introspected schema with the user - [Upgrade notes by release](https://askdb.tools/reference/upgrade-notes.md): what to change in an app for each AskDB release; needed only when upgrading - [Source code](https://github.com/Ygilany/AskDB): the AskDB repository, with runnable examples under `examples/`