Consider a simple question: “How many orders shipped late last quarter?” An AI agent might or might not return the correct answer. It does not know that the word “order” refers to different things in your sales and logistics systems, or that your company’s definition of a “late” shipment is in a contract the agent can’t access.
Your AI agents have to guess what your company’s words mean
A language model might know the dictionary definition of a word, and not know what a certain word means in the context of your company.
An ontology gives an agent this company-specific understanding. It is a structured set of definitions that explains your business terms and how they relate to one another.
The idea of using ontologies in AI is not new, but vendors and industry commentators have been promoting and debating them heavily in recent times. Some say an LLM only needs access to your database schema. Others argue that you must build a knowledge graph or buy a formal enterprise ontology platform before your agents can do anything useful.
When we build AI agents for our clients, we find that neither extreme is accurate. Our most useful “ontology” is often a set of well-organized text files, which some ontology specialists wouldn’t call an ontology at all. The type of ontology you need depends on the questions your agents need to answer. It’s just as important to understand that a major ongoing expense is the time and effort required from your staff to keep the ontology accurate as your business changes.
This article explains what an ontology in AI is, describes the four forms an ontology can take, and provides a simple method to help you decide which approach best serves your company’s needs.
What is an ontology in AI?
An ontology is a shared, documented model of how a business operates: the core concepts or entities involved, how they relate to one another, the business rules that govern them, and the actions that employees and agents are allowed to take.
It is written such that employees as well as software systems can read and use it. An ontology consists of five parts, each of which answers a basic question about a business.
Consider a marketplace where dealers list vehicles to be transported and carriers bid to transport them. Here’s how the parts of an ontology would apply to this business:
| Part of the ontology | The question it answers | Example in a car-shipping marketplace |
|---|---|---|
| Concepts | What entities or concepts exist in the business? | Dealer, Vehicle, Shipment, Carrier, Quote |
| Definitions | What does each term mean in the context of this company? | A Shipment means a single Vehicle transported from a pickup location to a delivery location under a single Quote |
| Relationships | How do these concepts connect to one another? | A Dealer requests a Shipment; a Carrier accepts it; each Shipment involves transporting one Vehicle |
| Rules | What business rules must always be followed? | A Shipment cannot be picked up until a Carrier has formally accepted it |
| Actions | What actions are employees and AI agents allowed to perform? | Accept a Quote, assign a Carrier to a Shipment, or flag a delivery as late |
- 1ConceptsWhat entities or concepts exist in the business?Dealer, Vehicle, Shipment, Carrier, Quote
- 2DefinitionsWhat does each term mean in the context of this company?A Shipment means a single Vehicle transported from a pickup location to a delivery location under a single Quote
- 3RelationshipsHow do these concepts connect to one another?A Dealer requests a Shipment; a Carrier accepts it; each Shipment involves transporting one Vehicle
- 4RulesWhat business rules must always be followed?A Shipment cannot be picked up until a Carrier has formally accepted it
- 5ActionsWhat actions are employees and AI agents allowed to perform?Accept a Quote, assign a Carrier to a Shipment, or flag a delivery as late
| Palantir | the semantic layer (concepts and the relationships between them), the kinetic layer (the actions that may be taken), and the dynamic layer (business rules and decision-making models) |
|---|---|
| Domain-Driven Design | entities, invariants, and commands |
| Graph databases | nodes, edges, and constraints |
Different communities use different terms to describe the same components. Palantir, which makes the concept of an ontology central to its Foundry platform, splits an ontology into three layers: the semantic layer (concepts and the relationships between them), the kinetic layer (the actions that may be taken), and the dynamic layer (business rules and decision-making models).
Software teams that follow Domain-Driven Design refer to these components as entities, invariants, and commands. In graph databases, they are nodes, edges, and constraints. The ideas are the same in each case.
We must distinguish an ontology from two related concepts it is often confused with:
- An ontology is not a database schema, which defines how data is organized and stored in a database. An ontology defines the business concepts represented by that data (along with the business rules that govern them).
- An ontology is not a knowledge graph. It is the abstract model or blueprint that defines business concepts, rules, and relationships—while a knowledge graph is the structure you create when you populate that blueprint with company records. We’ll soon look at this distinction in detail.
Why AI agents need an ontology
When an agent does not have an ontology, it infers the meaning of company-specific terms and rules. Inferences lead to four types of errors:
| Type of error | Example | How an ontology prevents the error |
|---|---|---|
| One word has different meanings in different systems | The word “order” refers to a dealer’s transport request in one system and to a carrier’s accepted load in another | It provides a single definition for each concept and specifies what term each system uses to refer to it |
| Different words are used to refer to the same concept | Different teams and databases use the terms “carrier,” “transporter,” and “vendor” to refer to the same company | It maps all synonymous terms to a single concept |
| Business rules exist outside the code | A vehicle cannot be picked up until a carrier accepts the shipment; this rule is written in an agreement (and does not appear in the database schema) | It documents rules explicitly—along with the source of each rule |
| Unverifiable answers | An agent calculates the number of late deliveries per carrier using the wrong date column in the database | It links each business term to the correct database fields so every answer is traceable |
The consequences of these errors depend on the type of agent and the tasks it performs:
Coding agents need to answer questions such as “How does our system define a Shipment, and which rules will be affected if we make a certain code change?” They primarily need definitions of business terms, the corresponding names used in the codebase, and the relevant rules. If a coding agent makes an error, it will likely be caught during code review and testing.
Business-facing AI agents need to answer questions such as “Which Carriers had more than three late deliveries for this Dealer last quarter?” These agents need definitions of the business terms and access to live company data so they can calculate the answer from actual records. If a business agent returns an incorrect figure, the mistake often goes unnoticed until the number is used to make a business decision.
Four ways to structure an ontology
You can implement the same business ontology at four levels of technical complexity. As you move down the table below the simplest structure to the most advanced, the ontology allows your agents to answer more complex types of questions while also requiring more time, money, and effort to build and maintain:
Choose an ontology structure by starting with the simplest and least expensive option that could plausibly meet your needs.
- Cost
- Cost
- Cost
- Cost
| Ontology structure | What it consists of | How the agent uses it | Best suited for | Cost |
|---|---|---|---|---|
| 1. Markdown catalog | A structured text document for each business concept, which lists its definition, the names used for it across systems, its relationships to other concepts, and the rules that apply to it (along with their source documents) | Reads the document as reference context before answering a question or writing code | Explaining the meaning of company terms; guiding coding agents | Low: An LLM can generate the initial draft and an expert can verify it |
| 2. Domain model in code | Business concepts represented as typed objects in code, mapped to your company’s source systems, with business rules written as code functions | Calls functions to look up records or check whether a rule has been met | Verifying rules with traceable evidence; resolving multiple names for the same entity; enforcing user access permissions | Medium: Requires standard effort including code review and testing |
| 3. Knowledge graph | A graph database that contains business records and the connections between them; it is loaded from your source systems through the domain model, with a sync pipeline that keeps it current | Traces connections across linked records to uncover multi-step relationships | Answering questions that involve chains of relationships or shared attributes (such as multiple vendors that share a bank account, or a chain of approvals) | Medium to high: A domain model in code (structure 2) makes building the graph faster, but running it is a cost of its own. Someone has to match duplicate records across systems (“Acme Logistics” vs “ACME Log. Inc.”), keep the graph in sync as source data changes, and run a graph database. |
| 4. Formal ontology | A standardized semantic model built using W3C standards (RDF, OWL, SHACL), queried using SPARQL, and mapped to relational databases using R2RML | Runs formal database queries and logical rule checks | Sharing a data model with partner companies; industry data standards; enabling software to infer new facts from existing rules | High: Requires knowledge engineers; relies on database mappings that must be updated when your source databases change |
As you compare these structures, it is important to remember that operational actions always have to be executed in code.
A knowledge graph or a formal ontology can explain what a term means and verify whether a condition has been met. But accepting a shipping quote or assigning a carrier to a shipment requires an executable code layer that carries out the action, writes the updated information back to the system that owns the record, and triggers an update to the knowledge graph. So if your agents need to perform actions, you’ll need a domain model in code (structure 2)—or a platform that provides the code layer—even if you also use a knowledge graph or a formal ontology on top of it.
How a single business rule (“late delivery”) looks across the four approaches
- Markdown catalog: The catalog contains a plain-text statement: “A delivery is considered late if it arrives after the promised delivery date (Source: Dealer Agreement).” The agent understands the definition but cannot inspect a shipment record on its own.
- Domain model in code: A function checks a shipment record and returns a “late / not-late” result, along with the shipment ID and the relevant rule from the agreement as evidence.
- Knowledge graph: Shipment records, carriers, and dealers are linked in the graph database, so the agent can trace connections to answer questions such as “Which dealers use a carrier that has delivered shipments late more than three times?”
- Formal ontology: The late-delivery rule is expressed as a standardized SHACL check, which your systems and a business partner’s systems can both run.
“A delivery is considered late if it arrives after the promised delivery date (Source: Dealer Agreement).”- The agent understands the definition
- cannot inspect a shipment record on its own
def check_late_delivery(s: Shipment, as_of: date) -> RuleResult: ... return RuleResult(status, evidence=[s.id, rule])
- A function checks a shipment record and returns a “late / not-late” result, along with the shipment ID and the relevant rule from the agreement as evidence.
- The agent can trace connections to answer questions such as “Which dealers use a carrier that has delivered shipments late more than three times?”
- The late-delivery rule is expressed as a standardized SHACL check, which your systems and a business partner’s systems can both run.
Here is a Python function that implements this rule in a domain model in code (structure 2):
from dataclasses import dataclass, field
from datetime import date
from typing import Literal
@dataclass
class Shipment:
id: str
carrier_id: str | None
promised_date: date
delivered_date: date | None
@dataclass
class RuleResult:
status: Literal["late", "on_time", "not_yet_due"]
evidence: list[str] = field(default_factory=list)
def check_late_delivery(s: Shipment, as_of: date) -> RuleResult:
"""Rule: a delivery is late if it arrives after the promised date
(Source: Dealer Agreement)."""
rule = "late-delivery rule (Dealer Agreement)"
if s.delivered_date is None:
# Not delivered yet: late once the promised date has passed
status = "late" if as_of > s.promised_date else "not_yet_due"
else:
status = "late" if s.delivered_date > s.promised_date else "on_time"
return RuleResult(status, evidence=[s.id, rule]) With this function in place, the AI agent can check a shipment record and provide evidence to support its answer.
Ontology vs knowledge graph vs semantic layer
People often use the terms “ontology,” “knowledge graph,” and “semantic layer” interchangeably, but each tool serves a distinct purpose:
| Ontology | Knowledge graph | Semantic layer | |
|---|---|---|---|
| What it is | The conceptual model of the business including its entities, definitions, relationships, rules, and permitted actions | A database that populates the model with business records and the connections between them | A set of definitions for calculating business metrics over a data warehouse |
| Example | “A Carrier accepts a Shipment; a delivery is late if it arrives after the promised date” | “Carrier 7 accepted Shipment 123, which was delivered two days after the promised date” | “late_deliveries = count of shipments where delivered_date > promised_date” |
| Typical tools | Markdown catalogs, typed code, or OWL models | Graph databases such as Neo4j, or RDF stores | dbt, Cube, or LookML |
| Primary strength | Defining business terms and enforcing business rules | Tracing connections and relationships across many records | Calculating metrics and aggregations consistently |
The ontology must come first when you are building your data architecture. An enterprise knowledge graph without an ontology is just a collection of linked records with no agreed-upon business meaning.
A semantic layer works alongside an ontology as well as a knowledge graph: Regardless of ontology structure, an agent can call the semantic layer when it needs to calculate a metric using the formula your finance team uses.
Choose the right approach by starting with the simplest option
Choose an ontology structure by starting with the simplest and least expensive option that could plausibly meet your needs. Move to a more complex one only if testing shows that the simpler option falls short—and that the accuracy gains of the next level up justify the added cost.
You can run this evaluation in five steps:
Compile a list of test questions: Collect 20 to 50 actual questions that your AI agents answer in day-to-day operations. Categorize each question by what it requires the agent to do: define a term, look up a single record, trace links across records, count records, or verify a business rule.
Prepare verified reference answers: Have a subject-matter expert write the correct answer for each test question. You’ll need this baseline to evaluate how each approach performs.
Test the simplest viable structure first: Run your test questions using the simplest structure that could reasonably handle them—and if you’re unsure, compare it against the next level up in complexity. Score each approach on its accuracy across question types, and check whether the agent can provide an explanation for its answers.
Calculate maintenance effort: The ongoing work required to keep the model current usually costs more, in terms of staff hours, than building the initial ontology.
Document your decision and review it quarterly: Record the test questions, accuracy scores, overall running and maintenance costs, the ontology structure you selected, and the conditions or business requirements that would justify moving to a more complex structure. Review this documentation every quarter.
What the evidence says:
Independent research shows that a database schema alone is not enough. On Spider 2.0, an academic benchmark built from real enterprise databases, the best AI agent solved only about one in five tasks, compared with over 90% on older, simpler benchmarks. Solving the tasks often required documentation and business context that the schema doesn’t contain.
Evidence that structured business context closes this gap comes mainly from vendors so far. Researchers at data.world, a knowledge-graph company, found that GPT-4 answered 16% of 43 insurance questions correctly from the schema alone, and 54% when it queried a knowledge graph built on an ontology. A 2024 follow-up that used the ontology to check and repair queries reached 72%, including cases where the system said it didn’t know, for a 20% error rate. The studies used GPT-4, and newer models will score differently. That’s why the method below asks you to test with your own questions instead of relying on published benchmarks.
Here’s our rule of thumb, which we’re still testing:
- A Markdown catalog is usually sufficient when your agents only need to understand company definitions and answer simple data questions.
- A domain model in code is the most effective choice when your agents need to verify rules or execute actions.
- A knowledge graph is best suited for questions that require tracing relationships across connected records.
- A formal ontology is worth the investment when you need to share a data model with partner organizations, comply with a data standard, or have the system infer new facts.
Move to a more complex one only if testing shows that the simpler option falls short—and that the accuracy gains of the next level up justify the added cost.
Whichever approach you choose, make sure your company maintains a single ontology as its master reference.
If different teams build and maintain separate models of the same business concepts, the models will diverge over time—and cause agents across your company to give conflicting answers.
Whichever approach you choose, make sure your company maintains a single ontology as its master reference. If different teams build and maintain separate models of the same business concepts, the models will diverge over time—and cause agents across your company to give conflicting answers.
Use industry standards as your starting point
Many industries have developed standardized data models that define core concepts and relationships in their sector. Using an existing industry standard as your foundation reduces the time and cost required to build your ontology, makes your definitions easier for auditors to review, and makes it simpler to exchange data with partners and regulators:
| Industry | Standard | What it provides |
|---|---|---|
| Banking and capital markets | FIBO (EDM Council) | Definitions of financial instruments, business parties, contracts, and ownership structures—published in OWL |
| Insurance | ACORD Reference Architecture | Data models that cover insurance policies, claims, parties, and products |
| Healthcare | SNOMED CT and HL7 FHIR | Comprehensive clinical terminology with formal logic, paired with a standard healthcare data-exchange format (also available in RDF) |
| Supply chain and retail | GS1 | Standard identifiers for products, locations, and shipments, along with definitions for supply-chain events |
| Manufacturing | Industrial Ontologies Foundry | Standardized terms for manufacturing products, production processes, factory equipment, and maintenance workflows—published in OWL |
| Energy and utilities | IEC CIM (IEC 61970 and 61968) | A standardized model of electrical grid assets and utility networks, exchanged in RDF format |
| General business | schema.org | Widely used general definitions for concepts such as organizations, people, products, and commercial offers |
These standards come in different formats: some are formal OWL ontologies, others are XML schemas, UML models or RDF vocabularies. The format matters less than the content. You can adopt their names and definitions whichever ontology structure you build, including a Markdown catalog.
The bottom line
Every AI agent that works with company data needs an ontology. Very few organizations need to build a complex ontology when they get started, though.
- Coding agents primarily need definitions of your business terms and rules, so a well-organized Markdown catalog is usually sufficient.
- Business-facing agents provide answers using live company data, so they need an ontology they can query directly. In most cases, this means building a domain model in code—often paired with a knowledge graph if your agents need to trace relationships across linked records, or a formal ontology if you need to follow an industry standard (or share your model).
- The largest long-term expense is the time and effort your employees will require. Staff will need to initially document how the business works, and then continuously update the ontology as your business evolves. Budget for this ongoing human effort before you commit to buying new software.
- 1.“Which questions must our agents answer,”
- 2.“What is the most cost-effective structure that will allow them to answer accurately?”
Ask two questions before you evaluate or purchase an enterprise ontology platform: “Which questions must our agents answer,” and “What is the most cost-effective structure that will allow them to answer accurately?” Test the structure against actual company questions. Document your results and review your choice every quarter.












