Skip to content
Gopi Krishna Tummala
Esc

Back
Intermediate Agentic AI 11 min read

Ontology: The Semantic Layer Agents Are Missing

By Gopi Krishna Tummala

An agent can retrieve the right documents, call the right tools and follow the right procedure, and still take an action the domain doesn’t allow. What’s missing is a shared model of what the things it manipulates actually mean.

A companion to the agentic AI series.


An airline support agent gets a message:

“Can you move me to the next available flight? I have a connection, and I need to be in San Francisco before 6 PM.”

Everything needed to serve this request is wired up. Retrieval can pull the fare rules and the rebooking policy. A knowledge graph holds the passenger, the booking and the flights. The booking system is exposed through tools: search availability, change a segment, reissue a ticket. A skill spells out the rebooking procedure step by step.

The agent searches, finds a seat on the 2:40 departure, calls change_segment, and tells the passenger they’re confirmed.

What it actually did was move the first leg of a two-leg itinerary. The second leg still departs at 1:15 from the old connecting airport. The fare class doesn’t permit a same-day change without a reissue, so the ticket is now out of sync with the booking, and the passenger will reach San Francisco the next morning, if at all.

Nothing in that chain was missing information. The schedule was available, the policy was retrievable, the tool worked exactly as documented. The failure is narrower and more interesting: the agent did not know that changing one segment can invalidate the segments after it. That fact isn’t in a document, isn’t a relationship in the graph, and isn’t in the tool’s description. It’s a property of the airline domain, and nobody had written it down in a form the agent could use.

That’s the gap an ontology fills: a shared, explicit model of what entities exist in a domain, what they mean, how they relate, what rules constrain them, and what operations are valid on them.

The idea in one picture

Each layer of a modern agent stack answers a different question, and the answers don’t substitute for one another.

flowchart TB
  RAG["Retrieval: what is written down?<br/>documents, policies, passages"]
  KG["Knowledge graph: what is connected to what?<br/>this passenger, this booking, this segment"]
  MCP["Tools via MCP: what can I do?<br/>search, change a segment, reissue"]
  SK["Skills: how do I do it?<br/>the rebooking procedure, step by step"]
  ONT["Ontology: what does it all mean,<br/>and what is allowed?<br/>classes, relationships, constraints"]
  RAG --> KG --> MCP --> SK --> ONT
  ONT -. "a shared vocabulary<br/>for all four above" .-> RAG

Five questions, five layers. An agent can have excellent answers to the first four and still act incorrectly, because none of them establish what a booking is or which changes the domain permits.

A short tour of the first four, and precisely where each one stops.

Retrieval finds text, not structure

Retrieval-augmented generation embeds the question, finds semantically similar chunks, and hands them to the model. For “what is our parental leave policy?” this is close to ideal: the answer exists in a document, written in roughly the words the question uses.

Now ask the airline question the support team actually gets twenty times a day: which passengers on tomorrow’s cancelled flight have onward connections they will now miss, and of those, which bought a fare that entitles them to rebooking on another carrier?

Every term in that question names an entity or a relationship. Semantic similarity will happily return the cancellation policy and a page about fare families, and none of that identifies a single passenger. The query is a traversal over structured state, not a search for similar text.

Retrieval gives an agent access to what has been written down. It does not give it a model of what exists.

Knowledge graphs connect facts, but don’t define them

A knowledge graph stores entities and the edges between them, usually as triples: Passenger_8841 — HOLDS → Booking_QX7R, Booking_QX7R — CONTAINS → Segment_2, Segment_2 — DEPARTS_FROM → DEN. Now the question above is a traversal: start from the cancelled flight, walk to its segments, to their bookings, to the passengers, and filter by fare family.

This is also the foundation of GraphRAG approaches, which retrieve over a graph’s entities and neighbourhoods rather than over isolated chunks, so connected evidence that never appeared in the same document can come back together.

But a graph stores facts in a vocabulary; it doesn’t guarantee the vocabulary means one thing. The classic version of this problem is mundane and expensive: the revenue system’s Customer is anyone who has ever bought a ticket, the loyalty system’s Customer is an account holder with a current tier, and the support system’s Customer is whoever is on the phone. Three nodes with the same label, three populations, and any agent reasoning across them will produce a confidently wrong number.

The graph says Alice is connected to Booking_QX7R by HOLDS. It doesn’t say whether HOLDS means she paid, she is travelling, or she is the corporate travel manager who booked it for someone else. That meaning has to live somewhere.

Tools expose operations, not eligibility

The Model Context Protocol solved a real integration problem: one standard way for an agent to discover and call tools across systems, instead of a bespoke adapter per service. Our agent gets search_availability, change_segment, reissue_ticket, refund.

A tool definition describes an operation’s inputs and outputs. It does not describe the conditions under which invoking it is correct. refund(order_id, amount) is silent on whether the order was already refunded, whether the amount exceeds what was paid, whether a partial refund is permitted for that product, and whether this refund needs a human approval. The tool will execute; the domain decides whether it should have.

You can push some of this into the tool implementation, and for high-stakes operations you should. But that scatters domain rules across however many services expose tools, in whatever language each is written in, invisible to the agent’s planning. The agent discovers the rule by violating it and reading the error, which is an expensive way to learn and a terrible way to plan.

Skills encode procedure, not meaning

Skills are the layer above tools: reusable procedural knowledge, a runbook the agent loads when the task matches. Our rebooking skill says to retrieve the booking, check the fare rules, find availability, change the segment, reissue, notify.

An agent can follow that sequence perfectly and still produce the broken itinerary from the opening, because “change the segment” assumes a shared understanding of what a segment is and what else depends on it. Procedure tells you the order of operations. It doesn’t tell you what the operations are operating on.

Three distinct questions, three distinct answers: tools say what I can do, skills say how I should do it, and the ontology says what these things are and what the domain permits.

What an ontology actually adds

The standard definition, from Tom Gruber’s work in the early 1990s, is that an ontology is a formal specification of a shared conceptualization: an explicit, machine-readable agreement about the concepts in a domain and how they relate. In practice it has four parts.

Classes — the kinds of things that exist: Passenger, Booking, Segment, Ticket, FareRule, Airport.

Attributes — the properties each kind carries: a Segment has a departure time, an arrival time, an origin, a destination and a status.

Relationships — the named, typed edges between them, with their cardinality: a Booking contains one or more Segments; a Segment connects to at most one following Segment; a Ticket prices exactly one Booking.

Constraints — the conditions that must hold for the domain to be consistent. These are the part that would have saved our agent:

# Illustrative, not a specific ontology language
Connection:  arrival_time + min_connection_time
             <= next_segment.departure_time
Segment:     changing one segment invalidates
             every later segment in the booking
Ticket:      a changed booking must be reissued
             before travel
Change:      allowed only if fare_rule.changeable,
             else fare difference + change fee

The distinction worth holding onto is between an ontology and a knowledge graph. The ontology is the model of the world; the graph is the contents of the world. The ontology says a Booking contains Segments and that changing one invalidates those after it. The graph says Booking_QX7R contains Segment_1 and Segment_2, and that Segment_2 departs at 1:15. You need both, and they fail differently: a wrong ontology makes every answer systematically wrong, while a wrong graph makes one answer wrong.

How the agent’s reasoning changes

With the domain model available, the rebooking request stops being a lookup followed by a tool call and becomes an operation checked against the model before anything is written.

flowchart TB
  REQ["Arrive in SFO before 6 PM"] --> RES["Resolve to domain objects<br/>Passenger, Booking, Segments 1 and 2, Ticket"]
  RES --> PLAN["Plan against the model<br/>the change touches Segment 1,<br/>so Segment 2 is affected"]
  PLAN --> CHK{"Check constraints<br/>connection time, fare rule,<br/>arrival before 18:00"}
  CHK -- "all hold" --> ACT["Execute as one unit<br/>change both segments, reissue"]
  CHK -- "fare rule fails" --> ALT["Offer the lawful options<br/>pay the difference, or<br/>the 3:10 on the same fare"]
  ACT --> VER["Verify the result<br/>against the model"]

The ontology changes where the checking happens. Instead of discovering the fare rule by getting an error from the reissue service, the agent knows the change is impermissible while it is still planning, and can offer the passenger something that is actually bookable.

Two things improved, and they’re worth separating. The agent’s plan got better, because the dependency between segments is explicit rather than something the model has to infer from a schedule. And the validation got stronger, because the constraints are checkable before the write, in one place, rather than being enforced by whichever downstream service happens to notice.

That second point connects to the more general argument in Part 4 of the design-patterns series: an agent’s claim that it did the right thing is worth much less than an independent check that it did. A domain model is one of the few things that makes such a check possible for business operations, where there’s no test suite to run.

Why enterprises are buying this argument

The reason ontology keeps coming up in enterprise AI is integration, not elegance.

A large company’s knowledge of a customer is split across a CRM, an ERP, a billing system and an incident tracker, each with its own schema, identifiers and assumptions, usually accumulated over a decade. An agent asked to find customers affected by yesterday’s payment outage and notify the ones with pending orders has to reconcile four notions of “customer” and three of “pending” before it can do anything useful.

An ontology can act as the semantic integration layer over those systems: one set of domain concepts, mapped down to each system’s schema, so the agent reasons about Customers and Orders rather than about table joins. That’s the pitch behind the ontology and semantic layers that vendors like Palantir and Databricks market, and it’s a real benefit when it works. It also makes the system easier to govern: domain rules written in one place can be reviewed by the people who own the business process, which is not true of rules scattered across service code.

The honest caveat is that this is the expensive layer. The mapping from concepts down to each source system is the actual work, and it has to be maintained as those systems change.

Where it isn’t worth it

An ontology is not a general upgrade, and several things it is sometimes credited with are not true.

It doesn’t make the model deterministic, and it doesn’t stop hallucination; a model can still misread a constraint or invent an entity, which is why the constraints need to be checked by code rather than merely shown to the agent. It doesn’t fix wrong data: a clean model over an inconsistent graph produces confident, well-structured errors. And it isn’t an authorization system or a transaction manager. The ontology says a refund over the amount paid is invalid; it doesn’t say this agent may issue refunds, and it won’t roll back a half-completed itinerary change.

A badly designed one costs more than none. Ambiguous class definitions, relationships nobody can explain, a model that grew to cover hypothetical cases, and the committee required to agree on what “customer” means are all real failure modes, and the modelling effort can consume a project before it ships anything.

My rule of thumb: the value scales with how interconnected, stateful and consequential the agent’s work is. A document Q&A assistant over a policy wiki needs retrieval and nothing more. An agent that reads a dashboard and writes a summary doesn’t need a domain model. An agent that modifies bookings, issues refunds or changes entitlements across several systems needs one, because in that setting the cost of a plausible-but-invalid action is paid by a customer.

Start with the slice the agent actually touches. For the rebooking agent that’s maybe eight classes and a dozen constraints, not the airline. Model the entities whose rules the agent can violate, and leave the rest of the world unmodelled until something needs it.

What I’d remember

  • Four layers answer four different questions. Retrieval finds text, graphs connect facts, MCP exposes operations, skills supply procedure. None of them defines what the entities mean.
  • Ontology is the schema; the knowledge graph is the contents. One says a booking contains segments and what that implies; the other says which segments this booking contains.
  • Tools describe operations, the domain decides validity. refund(order, amount) is silent on eligibility, prior refunds, limits and approvals.
  • The win is in planning and pre-write validation. Knowing a constraint during planning beats discovering it from a downstream error, and it gives you a check that doesn’t depend on the agent’s own say-so.
  • Model the slice the agent can break. Enough semantic structure to make the agent reliable, not a model of the whole enterprise before anything ships.

Where to go next

Questions to sit with

  1. In a system you work on, pick a word like “customer,” “active” or “complete.” How many different definitions does it have across your services?
  2. Which of your agent’s failures were missing information, and which were missing meaning? They need different fixes.
  3. For one consequential operation your agent can perform, where is the eligibility rule enforced today, and could the agent know it before it plans?