open source · Apache-2.0 · early development

Your business,
compiled.

Define an object once. Ontologiq compiles it into SQL views, governed tools for AI agents, and an explorable graph. Actions carry policy, approval and audit — declared in YAML, versioned in Git.

See what it compiles →
py ≥ 3.10 duckdb · postgres · snowflake · bigquery
objects/customer.yml
object: customer
identity: [customer_id]

state:
  active:  status == "active"
  churned: last_seen < now() - 90d

relations:
  orders:   has_many(order, on: customer_id)
  contract: has_one(contract)

actions:
  - issue_refund
      policy:   role in [support, finance]
      approval: required above 500
      audit:    true
→ 4 SQL views
→ 3 MCP tools
→ 1 explorable graph

Semantic layers tell you how much. Ontologiq knows who, in what state, and what may be done.

01
compile
in — objects/order.yml
object: order
identity: [order_id]

state:
  open:     fulfilled_at is null
  disputed: dispute_id is not null

actions:
  - cancel
      policy:   role in [support]
      requires: state == open
      audit:    true
out — ontologiq build
sql/order__open.sql view
sql/order__disputed.sql view
mcp/order.cancel tool · policy
graph/order node · 2 edges
4 files · 240ms · 0 warnings
02
govern

Policy

Who may call an action, expressed against the roles you already have. Denied calls never reach the warehouse.

Approval

Thresholds that put a human in the loop. The agent proposes, a reviewer signs, the state changes.

Audit

Every call is a row: actor, object, arguments, outcome. Queryable with the same SQL as the rest.

03 — agents

Agents get tools,
not table access.

Every action compiles into an MCP tool with a typed signature, its policy attached and its audit row written. The model never sees a connection string — it sees order.cancel and the objects it is allowed to act on.

  • Typed arguments, validated before execution
  • State preconditions enforced by the compiler
  • Approvals routed before anything is written
agent session
▸ tool call
order.cancel({ order_id: "ord_8812" })
▸ compiler
state == open
policy: role in [support]
approval required — routed to @lead
audit: 1 row written · actor agent:ops-01
04 — quickstart
step 01

Install

One package, no service to run.

$ pip install ontologiq
step 02

Declare an object

Identity, state, relations, actions.

$ ontologiq new object customer
step 03

Compile & serve

SQL to your warehouse, tools to your agents.

$ ontologiq build && ontologiq serve --mcp

One file. Four artifacts.
No platform.

Runs on the warehouse you already have. Nothing leaves your Git repo.

Read the docs