November 26, 2026

Aashish Singla

Ontology in AI: Choosing the Structure Your Agents Need

Ontology in AI: Choosing the Structure Your Agents Need

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 ontologyThe question it answersExample in a car-shipping marketplace
ConceptsWhat entities or concepts exist in the business?Dealer, Vehicle, Shipment, Carrier, Quote
DefinitionsWhat 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
RelationshipsHow do these concepts connect to one another?A Dealer requests a Shipment; a Carrier accepts it; each Shipment involves transporting one Vehicle
RulesWhat business rules must always be followed?A Shipment cannot be picked up until a Carrier has formally accepted it
ActionsWhat actions are employees and AI agents allowed to perform?Accept a Quote, assign a Carrier to a Shipment, or flag a delivery as late
What is an ontology in AI?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.
REQUESTSACCEPTSTRANSPORTING ONE VEHICLEUNDER A SINGLE QUOTEDealerCarrierShipmentVehicleQuoteRULESA Shipment cannot be picked upuntil a Carrier has formallyaccepted itAssign a CarrierFlag a delivery as lateAccept a Quote12345
  1. 1ConceptsWhat entities or concepts exist in the business?Dealer, Vehicle, Shipment, Carrier, Quote
  2. 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
  3. 3RelationshipsHow do these concepts connect to one another?A Dealer requests a Shipment; a Carrier accepts it; each Shipment involves transporting one Vehicle
  4. 4RulesWhat business rules must always be followed?A Shipment cannot be picked up until a Carrier has formally accepted it
  5. 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
Different communities use different terms to describe the same components.
Palantirthe 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 Designentities, invariants, and commands
Graph databasesnodes, edges, and constraints
The ideas are the same in each case.

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 errorExampleHow an ontology prevents the error
One word has different meanings in different systemsThe word “order” refers to a dealer’s transport request in one system and to a carrier’s accepted load in anotherIt 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 conceptDifferent teams and databases use the terms “carrier,” “transporter,” and “vendor” to refer to the same companyIt maps all synonymous terms to a single concept
Business rules exist outside the codeA 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 answersAn agent calculates the number of late deliveries per carrier using the wrong date column in the databaseIt 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:

Four ways to structure an ontologyYou can implement the same business ontology at four levels of technical complexity.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.

1
Markdown catalogBest suited forExplaining the meaning of company terms; guiding coding agentsReads the document as reference context before answering a question or writing code
Cost
Low
2
Domain model in codeBest suited forVerifying rules with traceable evidence; resolving multiple names for the same entity; enforcing user access permissionsCalls functions to look up records or check whether a rule has been met
Cost
Medium
3
Knowledge graphBest suited forAnswering questions that involve chains of relationships or shared attributesTraces connections across linked records to uncover multi-step relationships
Cost
Medium to high
4
Formal ontologyBest suited forSharing a data model with partner companies; industry data standards; enabling software to infer new facts from existing rulesRuns formal database queries and logical rule checks
Cost
High
Operational actions always have to be executed in code.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.
Ontology structureWhat it consists ofHow the agent uses itBest suited forCost
1. Markdown catalogA 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 codeExplaining the meaning of company terms; guiding coding agentsLow: An LLM can generate the initial draft and an expert can verify it
2. Domain model in codeBusiness concepts represented as typed objects in code, mapped to your company’s source systems, with business rules written as code functionsCalls functions to look up records or check whether a rule has been metVerifying rules with traceable evidence; resolving multiple names for the same entity; enforcing user access permissionsMedium: Requires standard effort including code review and testing
3. Knowledge graphA 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 currentTraces connections across linked records to uncover multi-step relationshipsAnswering 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 ontologyA standardized semantic model built using W3C standards (RDF, OWL, SHACL), queried using SPARQL, and mapped to relational databases using R2RMLRuns formal database queries and logical rule checksSharing a data model with partner companies; industry data standards; enabling software to infer new facts from existing rulesHigh: 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.
Four ways to structure an ontologyHow a single business rule (“late delivery”) looks across the four approaches
late-delivery rule (Dealer Agreement)A delivery is considered late if it arrives after the promised delivery date
Markdown catalog1
“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
Domain model in code2
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.
Knowledge graph3
dealerscarriersShipmentrecords
  • 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 ontology4
your systemsSHACLa businesspartner’s systems
  • 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 vs knowledge graph vs semantic layerPeople often use the terms “ontology,” “knowledge graph,” and “semantic layer” interchangeably, but each tool serves a distinct purpose
Must come first
OntologyDefining business terms and enforcing business rules
The conceptual model of the business including its entities, definitions, relationships, rules, and permitted actions“A Carrier accepts a Shipment; a delivery is late if it arrives after the promised date”Typical tools: Markdown catalogs, typed code, or OWL models
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.
Knowledge graphTracing connections and relationships across many records
A database that populates the model with business records and the connections between them“Carrier 7 accepted Shipment 123, which was delivered two days after the promised date”Typical tools: Graph databases such as Neo4j, or RDF stores
Semantic layerCalculating metrics and aggregations consistently
A set of definitions for calculating business metrics over a data warehouse"late_deliveries = count of shipments where delivered_date > promised_date"Typical tools: dbt, Cube, or LookML
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.
OntologyKnowledge graphSemantic layer
What it isThe conceptual model of the business including its entities, definitions, relationships, rules, and permitted actionsA database that populates the model with business records and the connections between themA 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 toolsMarkdown catalogs, typed code, or OWL modelsGraph databases such as Neo4j, or RDF storesdbt, Cube, or LookML
Primary strengthDefining business terms and enforcing business rulesTracing connections and relationships across many recordsCalculating 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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

What the evidence saysIndependent research shows that a database schema alone is not enough.
Researchers at data.world, a knowledge-graph companyGPT-4 answered … of 43 insurance questions correctly
From the schema alone16%
When it queried a knowledge graph built on an ontology54%
A 2024 follow-up that used the ontology to check and repair queries72%
Including cases where the system said it didn’t know, for a 20% error rate
On Spider 2.0, an academic benchmark built from real enterprise databasesThe best AI agent solvedabout one in five tasks
Older, simpler benchmarksover 90%
Spider 2.0one in five
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. 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.
Choose the right approach by starting with the simplest optionHere’s our rule of thumb, which we’re still testing
When your agents only need to understand company definitions and answer simple data questions
1Markdown catalogUsually sufficient
When your agents need to verify rules or execute actions
2Domain model in codeThe most effective choice
Questions that require tracing relationships across connected records
3Knowledge graphBest suited
When you need to share a data model with partner organizations, comply with a data standard, or have the system infer new facts
4Formal ontologyWorth the investment

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.

A single ontology as its master referencesingleontology

Whichever approach you choose, make sure your company maintains a single ontology as its master reference.

Separate models of the same business concepts

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:

IndustryStandardWhat it provides
Banking and capital marketsFIBO (EDM Council)Definitions of financial instruments, business parties, contracts, and ownership structures—published in OWL
InsuranceACORD Reference ArchitectureData models that cover insurance policies, claims, parties, and products
HealthcareSNOMED CT and HL7 FHIRComprehensive clinical terminology with formal logic, paired with a standard healthcare data-exchange format (also available in RDF)
Supply chain and retailGS1Standard identifiers for products, locations, and shipments, along with definitions for supply-chain events
ManufacturingIndustrial Ontologies FoundryStandardized terms for manufacturing products, production processes, factory equipment, and maintenance workflows—published in OWL
Energy and utilitiesIEC CIM (IEC 61970 and 61968)A standardized model of electrical grid assets and utility networks, exchanged in RDF format
General businessschema.orgWidely 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.
The bottom lineThe largest long-term expense is the time and effort your employees will require.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.
Ongoing human effortStaff will need to
Initially document how the business works
Continuously update the ontology as your business evolves
Knowledge graph
Match duplicate records across systems
Keep the graph in sync as source data changes
Run a graph database
Formal ontology
Requires knowledge engineers
Database mappings that must be updated when your source databases change
Budget for this ongoing human effort before you commit to buying new software.ASK TWO QUESTIONS BEFORE YOU EVALUATE OR PURCHASE AN ENTERPRISE ONTOLOGY PLATFORM
  1. 1.“Which questions must our agents answer,”
  2. 2.“What is the most cost-effective structure that will allow them to answer accurately?”
Coding agentsPrimarily need definitions of your business terms and rules, so a well-organized Markdown catalog is usually sufficient.
Business-facing agentsProvide answers using live company data, so they need an ontology they can query directly.
Review your choice every quarterTest the structure against actual company questions. Document your results and review your choice every quarter.

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.