If you've heard senior engineers throw around the word "ontology" and nodded along while quietly panicking — this one's for you. No philosophy degree required. We'll build the idea up from a list of words to the thing that powers AI agents, using examples you already understand.
Start with a lost dog
Imagine you find a dog in the street. It has a little tag. You want to get it home.
What do you actually need to know? The dog's name, sure. But really you need to know who owns it — and that's a relationship, not just a fact about the dog.
Hold that thought. That gap — between knowing words and knowing how things connect — is the entire idea of an ontology. Let's climb to it one step at a time.
👩💻 Mai (junior): Okay but isn't "ontology" just a fancy word for a database schema?
👨🏫 Hamed (mentor): That's the most common first guess, and it's close enough to be dangerous. A schema says what columns a table has. An ontology says what things exist in your business, how they relate, and what you're allowed to do to them — and then a bunch of other systems build on top of that single description. Stick with me, the difference becomes obvious.
The ladder: words → groups → meaning
There are three rungs, and each one knows a little more than the one below.
- Vocabulary is just naming things.
Dog.Owner.Tag. A glossary. - Taxonomy adds grouping. "A Dog is a kind of Animal. A Cat is a kind of Animal." Now you have a tree.
- Ontology adds the part that matters: how things actually connect, and the rules. "An Owner owns a Dog. A Dog wears a Tag. Every Dog must have exactly one Owner."
That last rung is the magic. Once your software knows "a Dog has an Owner," it can reason: scan the tag → find the owner → get the dog home. The words alone couldn't do that. The relationships could.
👩💻 Mai: So an ontology is basically... a map of how stuff connects?
👨🏫 Hamed: Exactly. A map of the things in your system and the arrows between them. Now let's draw a real one.
A real example: a tiny online shop
Forget dogs. Here's an ontology any web dev will recognize — an online store:
Read the arrows out loud and you get plain English: "A Customer places an Order. An Order contains Products. An Order ships to an Address. A Product belongs to a Category."
That's the whole vocabulary of an ontology:
- Boxes = the things (we call them objects or object types).
- Italic text inside = their properties (attributes).
- Arrows = the relationships (called links).
- Add a couple of rules on top — "an Order must contain at least one Product" — and you have a complete little ontology.
If you've ever drawn an ER diagram, you're 70% of the way there. The ontology just doesn't stop at "what tables exist" — it keeps going into behavior and permissions, which we'll get to.
Two everyday comparisons that make it stick:
- A LEGO instruction booklet lists every piece (objects), what each looks like (properties), and exactly how they snap together (links + rules). That booklet is an ontology for your LEGO set.
- A recipe names the ingredients, their amounts, and the steps connecting them. An ontology for a dish.
"Okay, but where does the data come from?"
Here's where beginners get confused, so let's be concrete. Your real data is messy. It's spread across databases, spreadsheets, half-broken CSV exports, and APIs. Columns have names like cust_id and full_nm. Nothing agrees with anything.
The ontology doesn't magically clean that up. Two separate jobs happen:
Job 1 — clean the data. A pipeline tool — the data-transformation step — takes raw inputs and transforms them: rename columns, drop junk rows, join tables together. The output is a tidy, reliable dataset. This is just ETL — the "T" (transform) you've probably already done in SQL or pandas.
Job 2 — map the clean data to objects. Now you declare: "this clean table is a Customer." You point at three things:
- The primary key — which column uniquely identifies one Customer.
- The property mappings —
cust_id → id,full_nm → name. - The link rules — the
order_refcolumn isn't just text, it's a relationship to an Order.
👩💻 Mai: Wait — so does this copy all my customer rows into the ontology?
👨🏫 Hamed: Great question, and the answer surprises everyone: mostly no. The mapping is a rule, not a copy. It's a pointer that says "interpret this dataset as Customers." Your actual rows stay where they live.
So where is "Customer" actually stored?
This is the question that breaks people's mental model, so let's nail it. A single Customer object is assembled from a few different places, each doing one job:
- The definitions and rules ("a Customer has id/name/email, keyed on id, linked to Order") are the only thing that genuinely lives inside the ontology. And they're tiny — it's metadata, measured in kilobytes, not terabytes. This is the "single source of truth."
- The actual values don't move. Your million rows stay in the database/warehouse they already lived in. The ontology just points at them.
- For speed, there's a serving index — a derived, read-optimized copy so "show me all customers in Hong Kong with an open order" is instant.
- When someone changes something, the edit can't go back into a read-only source export, so it lands in a separate writeback store, layered on top.
👩💻 Mai: So there is a new database — just for the definitions?
👨🏫 Hamed: Yes — but picture a catalog of definitions, not a copy of your data. It stores "a Customer looks like this," not your customers. Often it's literally version-controlled files (JSON/YAML/TypeScript) in a Git repo, so you get diffs and rollback for free. The meaning lives there; the data lives where it always did.
(Heads-up: smaller systems sometimes skip the fancy "point at the source" approach and just copy everything into one new store — a table, a document DB, or a graph database like Neo4j. Simpler, and totally fine until your data gets huge or changes constantly. Architecture is about trade-offs, not rules.)
Nouns are boring without verbs
Everything so far is nouns — things that exist. Customer, Order, the links between them. Useful, but static. A real system needs verbs — things you can do.
Two kinds of verb matter:
- Functions compute things. "Given this Order, what's its risk score?" A function reads objects, follows links, calculates, and returns an answer. It doesn't change anything — think of it as a pure calculation. (Rule of thumb: if the answer only depends on raw columns, do it in the cleaning pipeline instead. Save functions for logic that needs the live object graph.)
- Actions commit changes — safely. "Cancel this order." An action is a named operation with validation rules and an audit trail. It's the only sanctioned way to write, which is what keeps the data trustworthy.
So: a function can figure out the risk score; an action writes down "this order is cancelled" with the rules enforced and a record of who did it. Functions think; actions do.
Automations: the system's reflexes
Functions and actions are things that can happen. An automation makes them happen on their own when a condition is met. It's just condition → effect:
Let's trace one all the way through — the same way you'd debug a request. Scenario: a high-priority alert comes in and the system handles it without a human lifting a finger.
- Trigger — an automation is watching all Alerts. A new one with
priority = highmatches the condition. No polling you have to write; it reacts to the data changing. - Function — it computes a risk score using live context (the alert's linked asset, recent history). Nothing written yet.
- Action — score is high, so it assigns an owner and sets the status. Because it's an action, it's validated and recorded — and critically, it can be applied automatically or staged for a human to approve first.
- Webhook — it pings your external ticketing tool so nobody has to copy-paste.
- Result — the data reflects reality, and every step is logged.
👩💻 Mai: That "stage for review" bit — is that how you let an AI agent do stuff without it going rogue?
👨🏫 Hamed: Precisely. The agent proposes the change; a human clicks approve before it commits. That one toggle is the difference between "terrifying" and "shippable." Which brings us to the most underrated part...
Security: why letting an agent act is actually safe
Here's the part that separates a toy from a real platform. Security isn't a wall around the outside — it's computed fresh on every single request, by stacking gates.
Picture an airline's Passenger object with fields like Flight, Seat, Name, Address, Phone. Three people run the exact same query and get three different results:
- An ops user with no special clearance: sees ordinary passengers' flights and seats, but contact details are masked and VIP passengers don't appear at all.
- A support agent with the "PII" clearance: also sees names and phone numbers.
- The VIP desk with both clearances: sees everything.
Same data. Same query. Different slices — decided at runtime by what each person holds. That's cell-level security (rows × columns).
Two things make this genuinely powerful:
- Security tags travel with the data. Mark a column sensitive at the raw source, and that marking rides along through the cleaning pipeline and is inherited by the objects built from it. You don't re-secure it at every layer.
- Agents play by the exact same rules. An AI agent runs as an identity and hits the same three gates. It literally cannot see or act on data its user isn't cleared for. Remember our alert automation? It could only read the asset history and write the status because its identity was permissioned for those objects.
👩💻 Mai: Ohhh. So "let an agent run actions" isn't a leap of faith — it's just... a user with permissions.
👨🏫 Hamed: Now you get it. The agent isn't outside the rules. It's a fast, tireless coworker who's subject to the same access control as everyone else.
Bonus: the trace tool (lineage)
One more concept you'll hear: lineage. It's the recorded history of how a piece of data came to be — the chain from raw source, through every transform, to the final object.
Walk backward up that chain to find where a number came from (great for "why is this dashboard wrong?"). Walk forward to see everything that depends on a source (great for "what will I break if I change this?"). Because every step is versioned, you can trace any value to its exact origin. It's a family tree for your data.
Putting it all together
The whole story in one breath: raw data stays where it lives → a pipeline cleans it into a versioned dataset → a mapping turns that into objects and links → the ontology holds the definitions, rules, verbs, and permissions → an index makes reads fast and a writeback layer holds edits → and three kinds of consumer (a UI, a typed SDK, an AI agent) all build against that one shared contract.
The single idea worth tattooing on your brain:
Define your domain once — as a typed, rule-bound, governed model — and let humans, code, and AI agents all speak the same language. Change a rule in one place, and the UI button, the SDK, and the agent all instantly obey it.
That's it. That's an ontology. Not philosophy — just the discipline of describing your world once, properly, so everything else can stop arguing about what a "Customer" is.