---
title: "How to Use NVIDIA Auto Ontology with SQL Agents and MCP"
description: "Build a governed SQL semantic layer with NVIDIA Auto Ontology 1.3.0. Connect databases, compile business terms and joins into Postgres and pgvector, wire up the 9-tool MCP server, and verify an ontology locally with Docker and Apache Ossie."
author: "Jordan Hudgens"
author_handle: "@jordan"
canonical_url: "https://www.devguides.com/jordan/how-to-use-nvidia-auto-ontology-sql-agents-mcp"
published_at: "2026-11-30T02:02:00.69524+00:00"
updated_at: "2026-11-30T02:02:00.69524+00:00"
reading_minutes: 29
topics: ["ai-development", "sql", "postgresql", "python", "mcp", "agents", "llm", "ai"]
---

# How to Use NVIDIA Auto Ontology with SQL Agents and MCP

> Build a governed SQL semantic layer with NVIDIA Auto Ontology 1.3.0. Connect databases, compile business terms and joins into Postgres and pgvector, wire up the 9-tool MCP server, and verify an ontology locally with Docker and Apache Ossie.

Ask three teams at the same company what last month's revenue was, and you'll often get three different SQL queries back. Finance sums `sales.invoicelines.extendedprice` and filters out voided invoices. Operations queries `sales.orders_v2` and forgets that regional state names live four joins away through `customers`, `cities`, and `stateprovinces`. Meanwhile, a legacy pipeline still writes rows into `OLD_ORDERS` next to `NEW_ORDERS`. Hand all of those raw table schemas to a language model, and it will write syntactically valid SQL that returns the wrong number in half a second.

That's the exact failure mode [NVIDIA Auto Ontology](https://github.com/NVIDIA/auto-ontology) solves. NVIDIA introduced it on October 21, 2026 as part of the [Agent Knowledge Foundation](https://blogs.nvidia.com/blog/enterprise-platforms-agent-toolkit/) and released the code under Apache 2.0. Auto Ontology connects to your relational databases and warehouses, profiles their tables and query logs, and builds a governed business ontology in PostgreSQL and pgvector. On November 24, 2026, the [Auto Ontology 1.3.0 release](https://github.com/NVIDIA/auto-ontology/releases/tag/v1.3.0) replaced the original multi-agent LangGraph pipeline with a single bounded ReAct loop. On the BEAVER enterprise benchmark with Claude Opus 5.5, that change cut token use by 4x and reached an 82% prompt-cache hit rate.

> **Short answer:** NVIDIA Auto Ontology is an Apache-2.0 Python and Next.js system that compiles database schemas, sample values, and query logs into a business ontology stored in PostgreSQL 17 and pgvector. SQL and coding agents query that semantic layer over a 9-tool OAuth MCP server, a streaming REST API, or portable Apache Ossie YAML.

## What NVIDIA Auto Ontology builds (and what it isn't)

If you've worked with semantic-web tools before, the word "ontology" probably makes you think of OWL files, RDF triples, SPARQL endpoints, or extracting entities out of PDF documents. Auto Ontology doesn't do any of those things. Its inputs are live database connections across eleven SQL and warehouse engines, not unstructured text files. Its output is a structured semantic layer that maps everyday business nouns to physical columns, verified table joins, and reusable SQL expressions.

When an agent has to answer an open-ended data question, a raw `CREATE TABLE` dump leaves six questions unanswered. Auto Ontology stores a distinct record for each one:

| Question an agent faces | Ontology element | What Auto Ontology stores in PostgreSQL + pgvector |
| --- | --- | --- |
| What does a business word mean? | Concept (`term`) | A named business concept such as `Customer` or `Invoice Line`, with a plain description and synonyms (`renter`, `patron`) |
| Which tables hold it? | Mapping (`column_attribute`) | Direct links from each term to physical database columns, data types, and sampled values |
| How do tables connect? | Relationship (`semantic_fk`) | Declared foreign keys plus inferred joins that were tested against real rows before being saved |
| How is a metric calculated? | Metric (`sql_attribute`) | Reviewed `SELECT` expressions under a term, such as lifetime value or margin, so agents reuse one formula |
| Where did this number come from? | Lineage | Links from every term and measure back to source tables, plus the exact SQL and steps returned with every answer |
| Has a human checked this? | Certification | Review flags on term names, descriptions, and attributes so data owners can track what they've verified |

According to NVIDIA's [commit `5321cd0` verification](https://github.com/NVIDIA/auto-ontology/commit/5321cd075d0b831bdd1b1b4d3f617b6a19728c13) against the public leaderboards, this grounding placed Auto Ontology first on the [BEAVER enterprise text-to-SQL leaderboard](https://beaverbench.github.io/#leaderboard) (14.1% execution accuracy in Setting 0) and second on the public [BIRD-Interact c-Interact leaderboard](https://bird-interact.github.io/), with the [v1.3.0 release notes](https://github.com/NVIDIA/auto-ontology/releases/tag/v1.3.0) also reporting first place on BIRD-Interact-A and BIRD-Interact-C. Note how low 14.1% looks in absolute terms. Enterprise warehouse benchmarks without hand-written hints are still hard for frontier models, which is why inspecting the returned SQL matters just as much as the Semantic Compilation step.

You don't need this stack for every project. If you have one clean PostgreSQL database, twenty well-named tables, and a fixed set of dashboard queries, direct SQL or a short schema file is simpler to run. Auto Ontology earns its keep when users ask ambiguous questions in business terms, when metrics span conflicting schemas, or when your schema documentation no longer fits inside a prompt window.

Here's how a question travels from a messy schema to a verified SQL answer once the ontology is in place:

[Guide animation](https://www.devguides.com/api/media?path=devguides%2F8f6b6a61-d3c6-4277-8bf5-0cd4e1a800cd%2F335a29be-75ea-41fc-841c-ad87c3fd695f.mp4)

## What you'll set up and verify in this guide

In this guide, we're going to walk through both ways to run Auto Ontology 1.3.0 (`6725131`), how to wire it into MCP clients such as Cursor and Claude Desktop, and where its current sharp edges sit:

- Launch the full Docker Compose stack with an NVIDIA NIM key (or an OpenAI-compatible model router) and enable two-pass semantic compilation.
- Understand what changed in version 1.3.0 when the single 5-tool ReAct agent replaced the older LangGraph classifier and repair chain.
- Connect the 9-tool FastMCP server (`auto-ontology-mcp`) over OAuth so coding agents check readiness and entity coverage before running expensive SQL loops.
- Export and import the compiled layer as [Apache Ossie](https://ossie.apache.org/) YAML (`semantic_model.yaml`, `ontology.yaml`, and `mapping.yaml`) over the REST API.
- Run a four-part local lab using the repository's built-in `pgvector:pg17`, Pagila, and Chinook SQLite fixtures so you can inspect real API payloads, Ossie exports, and all 88 MCP tests on your laptop without an API key.

**Prerequisites:** Linux or macOS (Apple silicon has full wheel support, while Intel Macs skip the optional `kumo` extra), Docker with Compose v2, Python 3.12 or 3.13 managed with [`uv`](https://docs.astral.sh/uv/), and `curl` plus `jq`. Because `pyproject.toml` requires `>=3.12,<3.14` and rejects Python 3.14, pass `--python 3.12` to `uv` if your system Python is newer.

## How the four services and model roles fit together

Before editing `.env`, take a look at how Auto Ontology splits network boundaries and database schemas across its processes (`docs/architecture.md`):

![Architecture diagram of NVIDIA Auto Ontology 1.3.0 showing browser, REST, and FastMCP 3003 clients routing through Next.js 3000 into a private network with FastAPI 3001, Ingestion 3002, and PostgreSQL 17 with pgvector](https://www.devguides.com/api/media?path=devguides%2F8f6b6a61-d3c6-4277-8bf5-0cd4e1a800cd%2F22cb1d38-ce3e-4835-ad5b-0aec2674e37f.png)

Two operational rules in that diagram will save you from a bad deployment:

1. **Never expose ports `3001` or `3002` outside your private network.** All browser users, API-token scripts, and MCP calls go through the Next.js gateway on port `3000`. The FastAPI backend on `3001` trusts whatever user ID the gateway forwards in the `x-auto-ontology-user-id` header (`auto_ontology/server/identity.py`), and the ingestion service on `3002` has no authentication on its ingest, compile, or reset endpoints.
2. **Don't mix `CONNECTION_STRINGS` and UI-managed connections.** Per [`docs/connections.md`](https://github.com/NVIDIA/auto-ontology/blob/main/docs/connections.md), ingestion reads `CONNECTION_STRINGS` whenever that variable is set and ignores connections added in the UI. Question answering does the opposite: it checks UI-managed connections first and only falls back to `CONNECTION_STRINGS` when none exist. Pick one method per deployment. Also note that unless you configure all four HashiCorp Vault variables (`VAULT_ADDR`, `VAULT_NAMESPACE`, `VAULT_ROLE_ID`, and `VAULT_SECRET_ID`), UI-managed connection passwords are saved as unencrypted JSON in PostgreSQL.

Auto Ontology connects to eleven source engines defined in `auto_ontology/connectors/registry.py`: PostgreSQL, MySQL, Databricks, Snowflake, ClickHouse, Trino, Google BigQuery, Apache Kyuubi, HeavyDB, DuckDB, and SQLite. The first nine can be added through the UI or API, whereas DuckDB and SQLite work through `CONNECTION_STRINGS` only (`sqlite:////absolute/path/to/file.db`).

On the model side, `auto_ontology/utils/model_config.py` splits inference into four roles so you don't pay frontier-model latency on routine tasks:

| Role | Default with an `nvapi-` key | What calls it |
| --- | --- | --- |
| `REASONING` | `nvidia/nemotron-3.5-lightning-30b-a3b` | The ReAct answering loop, `check_answerable`, two-pass ontology compilation, and ambiguous PII checks |
| `NON_REASONING` | `nvidia/nemotron-3.5-lightning-30b-a3b` | Follow-up question rewrites, chart planning, PQL generation for predictions, and quick analysis steps |
| `EMBED` | `nvidia/nemotron-3.5-embed-1b` | Indexing tables, columns, terms, and SQL attributes in pgvector, plus query-time vector matching |
| `RERANK` | `nvidia/nemotron-3.5-rerank-8b` | Assigning bridge-table SQL attributes to an owning term during compilation (never called at query time) |

## Step 1: Launch Auto Ontology with Docker Compose and configure models

If you have an NVIDIA API key (`nvapi-...`) from [build.nvidia.com](https://build.nvidia.com), Docker Compose brings up PostgreSQL 17 with `pgvector`, `pgAdmin`, the one-shot Alembic and Prisma migration jobs, the FastAPI backend, the ingestion service, and the Next.js web app.

Clone the repository and create your `.env` file:

```bash
git clone https://github.com/NVIDIA/auto-ontology.git
cd auto-ontology
cp .env.example .env
```

Edit `.env` to set fresh passwords, an auth secret, your model key, and a source connection string. Remove the per-role `nvapi-your-api-key-here` placeholder lines from `.env` if you want all four roles to inherit `DEFAULT_MODELS_API_KEY`:

```dotenv
DEFAULT_MODELS_API_KEY=nvapi-replace-with-your-key
AUTH_SECRET=replace-with-output-of-openssl-rand-base64-32
APP_URL=http://localhost:3000

POSTGRES_USER=postgres
POSTGRES_PASSWORD=replace-with-strong-db-password
POSTGRES_DATABASE=auto_ontology
POSTGRES_PORT=5432

AUTO_ONTOLOGY_ADMIN_EMAIL=admin@example.com
AUTO_ONTOLOGY_ADMIN_PASSWORD=replace-with-strong-admin-password
PGADMIN_EMAIL=admin@example.com
PGADMIN_PASSWORD=replace-with-strong-pgadmin-password

# Example: connect Microsoft's Wide World Importers sample DB on the Compose Postgres service
CONNECTION_STRINGS=postgresql://postgres:replace-with-strong-db-password@postgres:5432/wideworldimporters
```

If you want to load the Wide World Importers sample dataset that NVIDIA uses in its quickstart, start the `postgres` container first and seed it from [`NVIDIA/auto-ontology-eval`](https://github.com/NVIDIA/auto-ontology-eval):

```bash
docker compose up -d --wait postgres
git clone https://github.com/NVIDIA/auto-ontology-eval.git ../auto-ontology-eval
(
  cd ../auto-ontology-eval
  uv sync --python 3.12
  cp .env.example .env
  POSTGRES_PASSWORD='replace-with-strong-db-password' \
    uv run --python 3.12 python scripts/seed/seed_wwi.py --database-name wideworldimporters --drop
)
```

Now build and start the full stack:

```bash
docker compose up -d --build
```

### Using OpenAI-compatible gateways instead of NVIDIA NIM

You aren't locked into hosted NVIDIA NIM endpoints, though there is a prefix rule in `auto_ontology/utils/llm_invoke.py` that trips people up. Inside `_build_client()`, Auto Ontology routes a model through LangChain's `ChatOpenAI` only when the model name starts with `openai/`, `azure/`, or `aws/`. Everything else goes through `ChatNVIDIA`.

Because `_build_client()` passes that `model` string straight through without stripping the `openai/` prefix, pointing `REASONING_ENDPOINT` directly at `https://api.openai.com/v1` with `openai/gpt-4.1` (or at a gateway whose upstream catalog expects a different prefix) will fail unless your router defines an explicit `openai/...` alias, such as a LiteLLM `model_name` mapping or a vLLM server started with `--served-model-name openai/qwen2.5-coder-32b`. We verified this prefix routing in `test_model_config.py` rather than against a live proxy, so test a single completion against your gateway before starting a full compile:

```dotenv
# Route chat roles through an OpenAI-compatible proxy alias while keeping fixed embeddings
REASONING_ENDPOINT=http://host.docker.internal:4000/v1
REASONING_API_KEY=sk-local-proxy-key
REASONING_MODEL=openai/reasoning-alias

NON_REASONING_ENDPOINT=http://host.docker.internal:4000/v1
NON_REASONING_API_KEY=sk-local-proxy-key
NON_REASONING_MODEL=openai/fast-alias
```

Whatever `EMBED_MODEL` you pick before your first ingestion, keep it fixed. Mixing vectors from two embedding models breaks similarity lookups until you run **Regenerate Embeddings** under **Settings -> Import / Export**. Native Anthropic `/v1/messages` calls aren't wired in directly yet ([issue #721](https://github.com/NVIDIA/auto-ontology/issues/721)), so Claude models need an OpenAI-compatible proxy in front of them.

## Step 2: Turn on two-pass compilation and see what v1.3.0 changed

When the containers come up, open `http://localhost:3000` and sign in with `AUTO_ONTOLOGY_ADMIN_EMAIL` and `AUTO_ONTOLOGY_ADMIN_PASSWORD`.

Here's the first thing almost every new user misses: **semantic compilation is turned off by default.** At boot, the ingestion service extracts your raw catalog (tables, columns, primary keys, declared foreign keys, views, and query history where the connector exposes it), but it doesn't call an LLM to build the ontology until an administrator flips the switch. Go to **Settings -> Semantic Compilation** and enable it. Once enabled, compilation runs immediately, repeats every 24 hours, and can be triggered on demand.

![Two stage diagram of NVIDIA Auto Ontology 1.3.0 showing two pass semantic compilation into PostgreSQL and pgvector followed by the bounded single ReAct loop with retrieve, run_sql, and submit](https://www.devguides.com/api/media?path=devguides%2F8f6b6a61-d3c6-4277-8bf5-0cd4e1a800cd%2F7033f047-6503-4118-aa20-d78df66dad7e.png)

### What happens during the two compilation passes

1. **Catalog ingest (`auto_ontology/ingestion_service/ingest.py`):** Reads schemas, keys, and recent queries (`INFORMATION_SCHEMA.QUERY_HISTORY` on Snowflake, `pg_stat_activity` over the past 24 hours on PostgreSQL, or BigQuery `JOBS_BY_PROJECT` when `location` is set), runs optional PII detection (**Settings -> PII Settings**), and embeds table and column names into `pgvector`. When a column is tagged as PII in v1.3.0, its sampled values are stripped from profiling, foreign-key probes, and vector embeddings.
2. **Per-table pass (`auto_ontology/semantic/visit_enter.py`):** Samples up to 1,000 rows per table using SQL, marks a column unique when at least 95% of its sampled values are distinct, infers date formats with rules, and uses the `REASONING` model (capped at `SEMANTIC_LLM_MAX_INFLIGHT=6` concurrent requests) to propose foreign-key candidates, column descriptions, and business terms with synonyms.
3. **Cross-table pass (`auto_ontology/semantic/compile.py`):** Groups prefixed table copies such as `OLD_ROOMS` and `NEW_ROOMS` into term families so they aren't confused, tests inferred foreign keys by running an actual join against the data (discarding links that share zero values), extracts up to 10 reusable SQL attributes per term from query history, and uses `RERANK` to assign bridge-table metrics to the right owning term.

When you edit a term or description later, Auto Ontology re-embeds it right away and preserves your work on the next run because compilation skips any table that already has a term. The one exception documented in `docs/architecture.md` is join selection: every compilation re-selects the default semantic foreign key for a join group, so disabling a join path manually won't persist across recompiles.

### How the v1.3.0 ReAct agent answers questions

If you read walkthroughs written for the earlier v1.0 and v1.1 releases, they describe a LangGraph workflow with an intent classifier, a separate metadata information agent, and an LLM SQL-repair loop. Version 1.3.0 deleted all three on November 24, 2026.

Instead, `auto_ontology/retrieval/text_to_sql/react/` runs a single plain-Python ReAct loop where the `REASONING` model starts with **no database schema** in its prompt and calls five tools:

- **`retrieve`**: Searches `pgvector` by meaning and the glossary by substring. Returns matching tables, column descriptions, sampled values, reviewed `sql_attribute` formulas, near-copy sibling tables, and verified join paths connecting new tables to ones already retrieved. Passing `purpose="information"` lets the agent answer catalog questions in plain English without writing SQL.
- **`run_sql`**: Validates every table and column name in a read-only `SELECT` against the catalog and **rejects any table that `retrieve` hasn't surfaced yet**. That single rule stops the model from guessing table names from training memory. It returns up to 100 rows (`TEXT_TO_SQL_REACT_MAX_RESULT_ROWS=100`).
- **`submit`**: Runs the same deterministic schema and execution checks on the final `SELECT`, then ends the loop with the query, the rows, a short plain-language explanation, and any open assumptions.
- **`grep`** (off by default, enabled with `TEXT_TO_SQL_REACT_GREP=true`): Searches up to 100,000 cached rows from a prior `run_sql` call by substring or regex.
- **`predict`** (offered only when `KUMO_RFM_API_URL` is set): Builds a relational graph over the retrieved tables and calls KumoRFM for predictive questions. Before turning this on, check your data governance policy: `predict` uploads up to `KUMO_MAX_TABLES` (20 by default) connected tables to the KumoRFM service.

By default, each question gets a budget of 24 tool calls (`TEXT_TO_SQL_REACT_MAX_TOOL_CALLS`) and 10 SQL executions (`TEXT_TO_SQL_REACT_MAX_SQL_RUNS`), and identical repeated tool calls are blocked while still counting against the budget.

On NVIDIA's Wide World Importers quickstart example, asking Chat *"What was revenue for the USB food flash drive - sushi roll in Pennsylvania in June 2015?"* resolves `Invoice Line`, `Stock Item`, `State Province`, and `Invoice`, walks the four-join path across five tables (`invoicelines -> invoices -> customers -> cities -> stateprovinces`), and returns `$588.80` across 3 invoice lines together with the full six-table `SELECT` statement so you can audit every join.

## Step 3: Connect Cursor, Claude Desktop, or your own agent over MCP

You don't have to use the built-in Chat UI to benefit from the ontology. The repository ships a standalone [Model Context Protocol](https://modelcontextprotocol.io) server under `mcp/auto_ontology_mcp` that exposes the semantic layer to any MCP client on port `3003`.

Notice why `mcp/pyproject.toml` packages it separately from the backend: the backend pulls over a hundred Python packages for database drivers and model clients, whereas `auto-ontology-mcp` depends only on `fastmcp`, `httpx`, `pydantic`, and `python-dotenv`. It installs in a few seconds on a developer laptop and holds zero database credentials or model keys of its own.

> **Install from GitHub, not PyPI:** Neither `auto-ontology` nor `auto-ontology-mcp` is published on PyPI yet (both return HTTP 404 on `pypi.org` as of November 29, 2026). Running `uvx auto-ontology-mcp` by itself fails. Point `uvx --from` at the `mcp` subdirectory on GitHub instead.

First, verify that your Auto Ontology web app is serving OAuth metadata on port `3000`:

```bash
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:3000/.well-known/oauth-authorization-server
```

Once that returns `200`, start the MCP server pointed at your web app's origin:

```bash
AUTO_ONTOLOGY_API_URL=http://localhost:3000 \
  uvx --from "git+https://github.com/NVIDIA/auto-ontology.git#subdirectory=mcp" auto-ontology-mcp
```

Now register `http://localhost:3003/mcp` (keep the `/mcp` path suffix) in your client config. Notice that there are no API tokens in either JSON file:

```json
{
  "mcpServers": {
    "auto-ontology": {
      "url": "http://localhost:3003/mcp"
    }
  }
}
```

For Claude Desktop (`claude_desktop_config.json`), bridge the HTTP transport through `mcp-remote`:

```json
{
  "mcpServers": {
    "auto-ontology": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:3003/mcp"]
    }
  }
}
```

When you restart Cursor or Claude Desktop, it detects the OAuth server, opens Auto Ontology's normal sign-in page in your browser, and stores a user-scoped grant. On every tool call, `auto-ontology-mcp` validates that opaque bearer token against Better Auth's UserInfo endpoint, so revoking an account or changing a user's role takes effect on the very next call.

### Why the MCP server exposes 9 read-only tools (and no schema browser)

Auto Ontology's OpenAPI spec (`docs/openapi/auto-ontology-api.json`) defines 87 operations, yet `mcp/auto_ontology_mcp/tools.py` exposes an explicit allowlist of nine read-only tools. It leaves out raw table and column browsers on purpose: giving a coding agent a raw schema browser invites it to bypass the semantic layer and guess SQL on its own again.

| MCP tool | Backing API route | When your agent should call it |
| --- | --- | --- |
| `check_readiness` | Health, catalog, connections, compilation status | First call on an unfamiliar deployment, or whenever `ask_question` comes back empty |
| `search_terms` | `GET /api/terms` | Look up business concepts (`Customer`, `Payment`, `Rental`) by case-insensitive name |
| `get_term` | `GET /api/terms/{term_id}` | Read one term's description, synonyms, related terms, and certification state |
| `get_term_columns` | `GET /api/terms/{term_id}/column-attributes` | Map a business term to physical columns and foreign-key targets |
| `get_term_sql_attributes` | `GET /api/terms/{term_id}/sql-attributes` | List reviewed `SELECT` formulas attached to a term before inventing math |
| `get_sql_attribute` | `GET /api/sql-attributes/{attr_id}` | Inspect the full SQL expression and purpose of one saved metric |
| `describe_table` | `GET /api/exploration/tables/{table_id}/details` | See which glossary terms map to a table and which query-history statements reference it |
| `check_answerable` | `POST /api/question-entity-coverage` | Cheap pre-flight check (default L2 `max_distance=0.75`) to verify the ontology covers every noun in a question |
| `ask_question` | `POST /api/chat/completions` | Run the full ReAct text-to-SQL loop and return structured `{answer, sql, rows, row_count, truncated}` |

Watch how that four-step tool sequence (`check_readiness -> search_terms -> check_answerable -> ask_question`) catches an unanswerable metric like "return on ad spend" before burning twenty model turns:

[Guide animation](https://www.devguides.com/api/media?path=devguides%2F8f6b6a61-d3c6-4277-8bf5-0cd4e1a800cd%2F5c8b7e01-8ae2-4e54-89a0-e86a16d62e5a.mp4)

If you also use Claude Code, Codex, or Cursor with repo skills, `NVIDIA/auto-ontology` ships three NVSkills-signed skill packages right under `skills/`: `nvidia-ontology-setup` (Compose, Helm, and readiness checks), `nvidia-ontology-query` (the pre-flight and SQL validation workflow), and `nvidia-ontology-management` (curating and certifying the layer over REST).

## Step 4: Stream answers, curate terms, and export Apache Ossie YAML over REST

Because the MCP server is strictly read-only, automation scripts that curate glossary definitions, trigger compilation, or export your semantic model to Git talk to the Next.js gateway on port `3000` using an API token minted under **User Menu -> API Tokens** (`x-api-key` header).

To run a question programmatically, stream server-sent events from `POST /api/chat/completions` (`docs/conversation-api.md`):

```python
import json
import os
import requests

response = requests.post(
    "http://localhost:3000/api/chat/completions",
    headers={"x-api-key": os.environ["AUTO_ONTOLOGY_API_TOKEN"]},
    json={"question": "Which film categories bring in the most rental payments?"},
    stream=True,
    timeout=900,
)
response.raise_for_status()

for line in response.iter_lines(decode_unicode=True):
    if not line or not line.startswith("data:"):
        continue
    payload = line.removeprefix("data:").strip()
    if payload == "[DONE]":
        break
    event = json.loads(payload)
    if event["type"] == "result":
        print("Answer:", event["answer"]["response"])
        print("SQL:\n", event["answer"]["sql_code"])
    elif event["type"] == "error":
        raise RuntimeError(event["message"])
```

To keep your semantic model portable across BI and agent tools, Auto Ontology integrates the [Apache Ossie converter](https://github.com/apache/ossie-converters/tree/main/nvidia) at `POST /api/model/export` and `POST /api/model/import`. Sending `{"format": "ossie"}` exports a single YAML semantic model, while adding `"include_ontology": true` (new in 1.3.0) returns a ZIP archive containing `semantic_model.yaml`, `ontology.yaml`, and `mapping.yaml`:

```bash
curl -sS -X POST http://localhost:3000/api/model/export \
  -H "x-api-key: $AUTO_ONTOLOGY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"format": "ossie", "include_ontology": true}' \
  -o ossie-bundle.zip
```

## Lab: Verify an Auto Ontology graph locally without an API key

You don't need an NVIDIA NIM key or a cloud data warehouse to inspect how Auto Ontology stores catalogs, maps cross-database terms, serves its FastAPI routes, exports Apache Ossie YAML, and builds its 9 MCP tools.

Inside `dev_tools/fixtures/`, the repository includes a deterministic multi-database fixture used by NVIDIA's own CI suite (`CONTRIBUTING.md`). It runs **real catalog ingestion** against two live engines (PostgreSQL's `pagila` database and SQLite's `chinook.sqlite`), then writes a **hand-authored reference ontology** through the same `auto_ontology.dal` layer that semantic compilation uses, with vector embedding stubbed out so zero LLM calls are required.

[Guide animation](https://www.devguides.com/api/media?path=devguides%2F8f6b6a61-d3c6-4277-8bf5-0cd4e1a800cd%2F009db2ca-d00f-404a-b79c-e795fcbdb126.mp4)

### Experiment 1: Start pgvector on port 5433 and run Alembic migrations

Clone the repo if you haven't already, sync the Python 3.12 environment with `uv`, start an isolated `pgvector/pgvector:pg17` container bound to `127.0.0.1:5433`, build the Pagila and Chinook source databases, and apply the Alembic schema migrations:

```bash
git clone https://github.com/NVIDIA/auto-ontology.git
cd auto-ontology
uv sync --python 3.12 --extra kumo

docker run -d --name auto-ontology-test -p 127.0.0.1:5433:5432 \
  -e POSTGRES_USER=auto_ontology \
  -e POSTGRES_PASSWORD=auto_ontology \
  -e POSTGRES_DB=auto_ontology \
  pgvector/pgvector:pg17

until docker exec auto-ontology-test pg_isready -U auto_ontology >/dev/null 2>&1; do
  sleep 1
done

export POSTGRES_HOST=localhost \
  POSTGRES_PORT=5433 \
  POSTGRES_USER=auto_ontology \
  POSTGRES_PASSWORD=auto_ontology \
  POSTGRES_DATABASE=auto_ontology

uv run --python 3.12 python -m dev_tools.fixtures.seed_fixtures
uv run --python 3.12 alembic upgrade head
```

You'll see `seed_fixtures` create the `pagila` database in PostgreSQL and compile `chinook.sqlite` (`1,007,616 bytes`), followed by Alembic reaching head revision `8d94b61ac2f0`:

```text
INFO dev_tools.fixtures.seed_local_postgres: Seed complete: pagila
INFO dev_tools.fixtures.seed_fixtures: Ready: chinook.sqlite (1,007,616 bytes)
INFO dev_tools.fixtures.seed_fixtures: All fixtures ready.
...
INFO  [alembic.runtime.migration] Running upgrade a7c3e9f1d204, e7a3d5c19f42 -> 8d94b61ac2f0, Merge term generation and conversation heads
```

### Experiment 2: Ingest both databases and inspect the ontology over FastAPI

Now point `CONNECTION_STRINGS` at both `pagila` (PostgreSQL) and `chinook.sqlite` (SQLite) and run `seed_graph_fixture --reset`:

```bash
CONNECTION_STRINGS="postgresql://auto_ontology:auto_ontology@localhost:5433/pagila,sqlite:///$PWD/dev_tools/fixtures/sql/chinook.sqlite" \
  uv run --python 3.12 python -m dev_tools.fixtures.seed_graph_fixture --reset
```

```text
INFO dev_tools.fixtures.seed_graph_fixture: ingesting catalogs...
INFO dev_tools.fixtures.seed_graph_fixture: ingesting pagila (postgres)
INFO dev_tools.fixtures.seed_graph_fixture: ingesting chinook (sqlite)
INFO dev_tools.fixtures.seed_graph_fixture: --- fixture ---
INFO dev_tools.fixtures.seed_graph_fixture:   databases        2
INFO dev_tools.fixtures.seed_graph_fixture:   tables           37
INFO dev_tools.fixtures.seed_graph_fixture:   columns          209
INFO dev_tools.fixtures.seed_graph_fixture:   terms            5
INFO dev_tools.fixtures.seed_graph_fixture:   sql_attributes   4
INFO dev_tools.fixtures.seed_graph_fixture:   custom_analyses  2
INFO dev_tools.fixtures.seed_graph_fixture:   pql_analyses     1
INFO dev_tools.fixtures.seed_graph_fixture:   zones            ['Film domain', 'Cross database', 'Retired zone']
```

Start the FastAPI backend on `127.0.0.1:3001` in the background and query its health, glossary terms, column mappings, and reviewed SQL attributes. Notice the route name for column mappings: the REST path is `/column-attributes` (`/columns` returns `404`), which the MCP server wraps as `get_term_columns`:

```bash
uv run --python 3.12 python -m auto_ontology.server >/tmp/ao-server.log 2>&1 &
AO_PID=$!
until curl -sf http://localhost:3001/api/health >/dev/null; do sleep 1; done

curl -s http://localhost:3001/api/health | jq .
CUSTOMER_ID=$(curl -s http://localhost:3001/api/terms | jq -r '.terms[] | select(.name=="Customer") | .id')
curl -s "http://localhost:3001/api/terms/$CUSTOMER_ID" | jq '{name: .data.name, synonyms: .data.synonyms, certification: .data.certification, related: [.data.related_terms[].name]}'
curl -s "http://localhost:3001/api/terms/$CUSTOMER_ID/column-attributes" | jq '[.data[] | {name, source_column, table: .primary_column.table_name}]'
curl -s "http://localhost:3001/api/terms/$CUSTOMER_ID/sql-attributes" | jq '[.data[] | {name, sql, certified}]'
```

```json
{
  "status": "ok",
  "postgres": { "status": "ok" },
  "migrations": { "status": "ok", "revision": "8d94b61ac2f0" }
}
{
  "name": "Customer",
  "synonyms": ["renter", "patron"],
  "certification": "partial",
  "related": ["Payment", "Rental"]
}
[
  { "name": "customer email", "source_column": "email", "table": "customer" },
  { "name": "customer id", "source_column": "customer_id", "table": "customer" }
]
[
  {
    "name": "customer lifetime value",
    "sql": "SELECT customer_id, sum(amount) FROM payment GROUP BY customer_id",
    "certified": false
  }
]
```

Four of the five seeded terms (`Customer`, `Film`, `Payment`, and `Rental`) map to PostgreSQL's `pagila` schema, while `Track` maps across engines to SQLite's `chinook` `main` schema.

### Experiment 3: Export the Apache Ossie three-file bundle

With the backend still running on `localhost:3001`, export the ontology in Apache Ossie format with `include_ontology: true` and inspect the generated YAML files:

```bash
curl -sS -X POST http://localhost:3001/api/model/export \
  -H "Content-Type: application/json" \
  -d '{"format": "ossie", "include_ontology": true}' \
  -o /tmp/ossie-model.zip

python3 -m zipfile -l /tmp/ossie-model.zip
python3 -c '
import zipfile
with zipfile.ZipFile("/tmp/ossie-model.zip") as zf:
    print("\n".join(zf.read("ontology.yaml").decode().splitlines()[:16]))
'
```

```text
File Name                                             Modified             Size
semantic_model.yaml                            2026-11-30 01:18:20        55085
ontology.yaml                                  2026-11-30 01:18:20         2934
mapping.yaml                                   2026-11-30 01:18:20         1669

version: 0.2.0.dev0
name: auto_ontology_model_ontology
description: Business concepts of the auto_ontology_model semantic model
ontology:
- concept: Customer
  type: EntityType
  description: A person who rents films from a store.
  relationships:
  - name: customer_id
    description: Primary key of customer.
    roles:
    - concept: Integer
    multiplicity: ManyToOne
    verbalizes:
    - '{Customer} has customer id {Integer}'
  - name: customer_email
```

Look inside `semantic_model.yaml` as well (`python3 -c 'import zipfile; print("\n".join(zipfile.ZipFile("/tmp/ossie-model.zip").read("semantic_model.yaml").decode().splitlines()[:35]))'`): Auto Ontology preserves its `sql_attribute` expressions inside an `NVIDIA_AUTO_ONTOLOGY` vendor extension block so round-trip imports don't lose custom SQL formulas.

### Experiment 4: Verify the 9-tool MCP surface and run the test suites

In production, live MCP tool calls authenticate through Next.js OAuth on port `3000`. Locally, you can inspect the exact tool definitions generated from `auto-ontology-api.json` and run all 88 MCP tests plus the model-routing and Kumo test suites:

```bash
kill "$AO_PID"

(
  cd mcp
  uv run --python 3.12 pytest -q
  uv run --python 3.12 python -c '
import asyncio
from auto_ontology_mcp.config import load_settings
from auto_ontology_mcp.server import build_server

async def main():
    mcp, _ = build_server(load_settings())
    tools = await mcp.list_tools()
    print(f"{len(tools)} MCP tools:", ", ".join(t.name for t in tools))

asyncio.run(main())
'
)

uv run --python 3.12 pytest auto_ontology/utils/tests/test_model_config.py -q
uv run --python 3.12 --extra kumo pytest auto_ontology/retrieval/kumo -q

docker rm -f auto-ontology-test
```

```text
88 passed in 3.24s
9 MCP tools: ask_question, check_readiness, describe_table, check_answerable, get_sql_attribute, search_terms, get_term, get_term_columns, get_term_sql_attributes
10 passed in 2.61s
210 passed in 7.62s
auto-ontology-test
```

## Production limits and common failure modes

Auto Ontology is moving quickly (over 750 issues and pull requests on GitHub), and reading the source code alongside open issues turns up several boundaries worth knowing before you put it in front of stakeholders:

- **Certification doesn't filter retrieval:** Marking a term or SQL attribute `certified` records human review in PostgreSQL and displays a badge in the UI and API responses, yet `auto_ontology/retrieval/` doesn't filter out uncertified items (`docs/architecture.md`). If a drafted SQL attribute is wrong, edit or delete it rather than assuming uncertified drafts will be ignored.
- **Table allow/deny filters apply to UI connections only:** Issue [#255](https://github.com/NVIDIA/auto-ontology/issues/255) added `table_allow_regex` and `table_deny_regex` (shipped in PR `#299`), and `deny` wins. However, those filters only attach to connections managed through the UI or `/api/connections`. Databases configured via `CONNECTION_STRINGS` ingest every visible table.
- **Same-named tables across schemas can collide on join anchors:** In open [issue #726](https://github.com/NVIDIA/auto-ontology/issues/726) (filed November 28, 2026), two tables with the same unqualified name in different schemas (such as `ops.devices` and `archive.devices`) can resolve to the same anchor during `retrieve` join discovery. Scope out archive or staging schemas on UI connections until that fix lands.
- **Per-table compilation exceptions don't fail the batch status:** In open [issue #759](https://github.com/NVIDIA/auto-ontology/issues/759), an exception thrown while compiling an individual table is logged and skipped while the overall compilation run still reports `succeeded`. Check the `ingestion-service` container logs after your first compile to verify that expected tables received terms.
- **Query-history mining depends on the engine:** SQL attribute suggestions from past queries only fire where the connector returns recent statements (such as Snowflake `INFORMATION_SCHEMA.QUERY_HISTORY`, BigQuery `JOBS_BY_PROJECT` with `location` set, or PostgreSQL `pg_stat_activity`, where [issue #703](https://github.com/NVIDIA/auto-ontology/issues/703) notes active queries from sibling databases on the same server can appear). On SQLite or DuckDB, you author SQL attributes in the UI or REST API instead.

| Symptom | Root cause | Fix |
| --- | --- | --- |
| Ingestion succeeds, `GET /api/terms` is empty, and `ask_question` says Auto Ontology can't answer | Semantic Compilation defaults to **off** on a fresh install | Sign in at `:3000`, open **Settings -> Semantic Compilation**, and toggle it on |
| `uvx auto-ontology-mcp` fails with package not found | `auto-ontology-mcp` isn't published on PyPI yet | Install from GitHub: `uvx --from "git+https://github.com/NVIDIA/auto-ontology.git#subdirectory=mcp" auto-ontology-mcp` |
| MCP client says `Protected resource ... does not match expected` | Hostname mismatch between `127.0.0.1` and `localhost` in OAuth resource metadata | Set `AUTO_ONTOLOGY_MCP_PUBLIC_URL` to the exact URL in your MCP client config |
| `ask_question` returns an empty answer with no SQL and no error | Either the source DB connection dropped while the catalog stayed in Postgres, or no term matched the question's nouns | Call `check_readiness` first to confirm `can_execute_sql` is true, then check vocabulary with `search_terms` |
| Backend container `500`s with `UndefinedTable` or `uv sync` fails on Python 3.14 | Backend booted before `auto-ontology-migrate` finished, or system Python is >=3.14 | Keep `depends_on: auto-ontology-migrate (service_completed_successfully)` in Compose, and pass `--python 3.12` to `uv` |
| Web UI loads without its left navigation after a restart | Stale Better Auth session cookie after `AUTH_SECRET` changed or the database was reset | Clear site data for `localhost:3000` (or delete `better-auth.session_token`) and sign in again |

## Frequently asked questions

### Is NVIDIA Auto Ontology an OWL, RDF, or Neo4j knowledge-graph tool?

No. Despite the name, Auto Ontology doesn't generate OWL ontologies, RDF triples, or SPARQL graphs from unstructured documents. It connects to relational databases and SQL warehouses, builds a business glossary mapped to physical columns, joins, and SQL formulas in PostgreSQL 17 with `pgvector`, and exchanges models as Apache Ossie YAML.

### Can I run NVIDIA Auto Ontology with OpenAI, Claude, or local Ollama and vLLM models?

Yes, if your OpenAI-compatible gateway defines an explicit `openai/...` model alias. In `auto_ontology/utils/llm_invoke.py`, models prefixed with `openai/`, `azure/`, or `aws/` use `ChatOpenAI` against your custom `<ROLE>_ENDPOINT`, while other names use `ChatNVIDIA`. Because the `openai/` prefix isn't stripped from the request payload, configure a proxy alias such as a LiteLLM `model_name: openai/...` mapping or a vLLM `--served-model-name openai/...` flag, keep one fixed `EMBED_MODEL`, and note that native Anthropic `/v1/messages` support is still open ([issue #721](https://github.com/NVIDIA/auto-ontology/issues/721)).

### What changed in NVIDIA Auto Ontology 1.3.0?

Released on November 24, 2026, version 1.3.0 replaced the earlier LangGraph text-to-SQL graph (intent classifier, separate metadata agent, and SQL repair loop) with one bounded ReAct agent (`retrieve`, `run_sql`, `submit`, plus optional `grep` and `predict`). It also added PII sample withholding, prefix-based term families, `include_ontology` Apache Ossie exports, and a smaller 1.31 GB container image.

### How do I connect Cursor or Claude Code to NVIDIA Auto Ontology?

Run `AUTO_ONTOLOGY_API_URL=http://localhost:3000 uvx --from "git+https://github.com/NVIDIA/auto-ontology.git#subdirectory=mcp" auto-ontology-mcp`, point your MCP client at `http://localhost:3003/mcp`, and complete the browser OAuth sign-in. You can also load the repository's three agent skill folders (`skills/nvidia-ontology-setup`, `nvidia-ontology-query`, and `nvidia-ontology-management`) so your agent follows the readiness and pre-flight workflow automatically.

### Does certifying a term in Auto Ontology restrict what the SQL agent retrieves?

No. Setting certification on a term name, description, or SQL attribute marks it as human-reviewed in the UI and API responses, which helps data teams track governance progress. Retrieval searches both certified and uncertified records, so fix or delete inaccurate auto-compiled metrics directly instead of leaving them uncertified.

> **Final takeaway:** Giving a language model raw `CREATE TABLE` statements asks it to guess your business logic on every turn. Compiling terms, verified join paths, and reviewed SQL formulas into an ontology moves those rules out of prompt guesswork and into a layer you can inspect, test, export as Apache Ossie YAML, and share across every MCP agent you run.

I hope that this has been a helpful guide to setting up, verifying, and connecting NVIDIA Auto Ontology 1.3.0. If you try it against one of your own schemas, let me know in the discussion below which joins or metrics the compiler got right on the first pass and which ones needed a human edit.

