A wall installation of a knowledge graph: labeled concept nodes such as Needs, Knowledge and Science connected by strings
Back to Work & InsightsComprehensive Guide

Ontology for Enterprise AI

If an agent can already call your software APIs and finish the job, why build an ontology? When the extra layer pays for itself, and when it's overhead.

TL;DR

  • An ontology is a shared, machine-readable model of your business: the things that exist (Customer, Order, Listing), how they relate, and the actions allowed on them, mapped onto your real systems.
  • Agent + APIs is enough when the work lives inside one or two systems and the definitions are not disputed. Most SMB automations are in this bucket.
  • The ontology layer pays off when questions cross several systems, several agents need the same definitions, or the agent writes back to systems where a mistake is expensive.
  • Start with a minimum viable ontology of 5–10 objects around one use case. Do not model the whole company up front.
System control · Typical API wrapper

Hand the whole flow to the LLM and let it reason end to end

System control · FDE architecture

Ontology as the shared model, with deterministic state-machine guardrails

01 · Definition

What an ontology actually is

Not a database and not a diagram. An ontology is a model of the business that sits between your systems and your AI, so the AI reasons about Leads and Listings instead of endpoints and table rows. It has four parts:

Object types
Lead, Listing, Showing, Agent

The nouns of the business, each with one canonical ID even if five systems store it differently.

Properties
Lead.budget, Listing.price, Listing.city

Typed attributes with one agreed meaning, e.g. “budget” is always USD, always the buyer's stated max.

Links
Lead —viewed→ Listing, Lead —has→ Showing

Relationships stored explicitly, so the agent traverses them instead of guessing joins across APIs.

Actions
ScheduleShowing(lead, listing, time)

Governed write operations with validation, permissions, and an audit trail, rather than raw POST endpoints.

02 · Worked example

Same question, two architectures

A real estate brokerage keeps leads in a CRM, listings in the MLS, browsing data in web analytics, and showings in a calendar. The broker asks:

Which of my leads viewed 3+ homes under $1.2M in Irvine last month but haven't had a showing in 14 days?
Agent + APIs
6 steps, re-done on every request
  1. 01Call CRM API → list leads (paginated)
  2. 02Call website analytics → page views per visitor
  3. 03Match visitors to leads by email or name (fuzzy)
  4. 04Call MLS API → listing price and city for each view
  5. 05Call calendar API → showings per lead
  6. 06Join everything inside the context window
Agent + Ontology
3 steps over pre-linked objects
  1. 01Query: Lead → viewed → Listing (price < 1.2M, city = Irvine)
  2. 02Filter: count ≥ 3, no linked Showing in 14 days
  3. 03Action: ScheduleFollowUp(lead), validated and logged

Both can work. The difference is where the integration work happens: on every single request (APIs), or once, ahead of time (ontology).

03 · Failure modes

Where agent + APIs starts to break

None of these show up in a demo. They show up in month three, when more systems, users, and agents are connected.

Semantic drift

“Active customer” means paid-in-90-days in billing and logged-in-in-30-days in the product DB. The agent picks one at runtime, differently each time.

The definition is written down once and every agent uses it.

Identity resolution

The same person is a contact ID in the CRM, an email in Stripe, and a phone number in the calendar. The agent fuzzy-matches on every request.

Entities are resolved once at ingestion; the agent sees one Lead.

Compounding errors

A question across 4 systems is 4+ tool calls plus a join. If each step is 95% reliable, the chain is ~81%, and it costs tokens and latency every time.

Cross-system questions become one traversal over pre-linked data.

Governance

The agent holds API keys with system-wide access. Row-level permissions and audit are re-implemented per integration, or skipped.

Permissions and audit live on objects and actions, so every agent and app inherits them.

Unsafe writes

The agent can call any endpoint it has a key for. Business rules (“never discount below margin”) live in a prompt.

Actions carry validation rules in code. The agent can only propose writes the business allows.

No reuse

Agent #2 rebuilds the same integration glue as agent #1, with slightly different assumptions.

Build the model once; every new agent, dashboard, or app plugs into it.

04 · Comparison

Ontology vs. RAG: different layers, not rivals

Both give an AI access to business knowledge, so they get compared. But RAG decides which text the model reads; an ontology decides what the business's objects are. They answer different questions.

Question it answers
RAG: “What do our documents say about X?” Ontology: “What is true about this Lead, and what am I allowed to do with it?”
Data it works on
RAG: unstructured text such as PDFs, wikis, and emails. Ontology: typed objects, properties, and links mapped from systems of record.
When meaning is resolved
RAG: at query time, by the model reading retrieved chunks, every time. Ontology: once, at modeling or ingestion time, then reused.
Strong at
RAG: open-ended questions over large text collections. Ontology: exact filters, counts, multi-hop joins across systems, and governed writes.
Weak at
RAG: completeness, aggregation (“how many…”), and consistency between runs. Ontology: anything that wasn't modeled, and the upfront effort.
Writes back?
RAG: no, it is read-only by design. Ontology: yes, through actions with validation and an audit trail.
“How many of our Irvine listings are in HOAs that cap rentals?”
RAG over listing and HOA documents
Counts whatever it happened to retrieve
  1. 01Embed the question; retrieve the top-k chunks
  2. 02Chunks mention a few HOAs with rental caps
  3. 03Model counts what is in front of it
  4. 04Answer: “at least 3”, with no way to know what was missed
Ontology
Counts what is true
  1. 01Traverse: Listing → in → Property → governedBy → HOA
  2. 02Filter: HOA has a Clause where ruleType = rental_cap
  3. 03Return an exact count, with the list behind it

Aggregation and completeness questions are where similarity-based retrieval breaks. They need structure.

Most real systems use both: retrieval or long context to read documents, and LLM extraction to turn what was read into ontology objects (a clause, a limit, an obligation), so the next question is a query instead of another reading. Graph-based retrieval (GraphRAG) sits between the two. The Listing & Lease Compliance case study shows this pattern in practice, and “Why Everyone Built RAG, and Why Many Teams Are Moving On” covers where classic RAG still fits.

05 · Decision

Do you need one? Check what applies

Most small businesses running one or two SaaS tools don't need an ontology yet, and shouldn't pay for one. Tick what's true for your use case:

Your score: 0 / 6

Agent + APIs is enough

Connect the agent to your tools (APIs or MCP servers) and ship. Write your key definitions into a short glossary the agent reads, and revisit when you add systems.

06 · Trade-off

What the extra layer costs

The cost of the ontology is mostly fixed and paid up front. The cost of not having one grows with every system and agent you add. The crossover is the point where it's worth it.

Modeling time
Workshops with domain experts to agree on objects and definitions. This is the real work, not the software.
Data pipelines
Syncing and resolving entities from each source system, and keeping that sync healthy.
Maintenance
When a source system changes its schema, the mapping changes too.
Over-modeling risk
Trying to model the whole company before shipping one use case is the most common way these projects stall.
07 · Playbook

Start with a minimum viable ontology

Not a six-month modeling project. One question, the few objects it needs, shipped and measured.

  1. 01Pick one high-value question the business asks weekly and can't answer quickly.
  2. 02List only the objects and links that question needs, usually 5–10.
  3. 03Agree on definitions with the people who own the numbers and write them down.
  4. 04Resolve identities for those objects across sources; sync on a schedule.
  5. 05Expose objects and 1–3 governed actions to the agent as tools (MCP works well here).
  6. 06Ship, measure answer accuracy against a test set, then add the next use case.

Implementation options

SMB · fastest start
Typed model in Postgres + MCP server

Tables and views for core objects, one MCP server exposing object-level tools and validated actions.

Analytics-heavy
Semantic layer (dbt Semantic Layer, Cube)

Governed metrics and definitions on top of a warehouse. Strong for “what is our number” questions.

Relationship-heavy
Knowledge graph (Neo4j, RDF/OWL)

Best when the value is in multi-hop relationships: supply chains, fraud, research data.

Large enterprise
Enterprise ontology platform (e.g. Palantir Foundry)

Objects, links, actions, and permissions as a managed platform. Heavy, but complete.

Ontology and MCP are not either/or. MCP is how the agent connects; the ontology decides what it connects to. Exposing get_lead and schedule_showing as MCP tools beats exposing forty raw CRM endpoints.

More guides

Want this built into your workflow?

I help small and mid-size teams decide what to build, then build it, from the first eval set to production guardrails.

Talk through your use case