Why Agentic Systems Need Ontologies — Frank Coyle, UC Berkeley
Frank Coyle, CS educator at UC Berkeley with a background in neuroscience and expert systems, argues that most agentic AI failures stem from a single architectural gap: the absence of a formal ontology sitting outside the model as logical guardrails. His prescription is neurosymbolic AI — probabilistic reasoning inside the LLM, deterministic logic outside it — implemented concretely as a Claude tool-use loop wrapped with Pydantic type validation and an ontology-based constraint validator.
Key Takeaways
- LLM hallucination is not a bug but a feature of probabilistic systems; prompt engineering alone cannot close the reliability gap for agentic tasks 5:02
- An ontology is simply typed entities, relationships, and constraints expressed as a graph data structure — not complicated, but powerful 5:23
- RDFS and OWL add inference and hard constraints (functional properties, disjoint classes, enumerated values) that sit outside the graph and can validate agent outputs 9:12
- The architectural pattern: Pydantic validates types at the tool-call boundary; the ontology validates semantic correctness of results before any side effects are committed 17:47
- Concrete errors an ontology catches that English instructions cannot reliably prevent: duplicate refunds, payments routed to wrong entity types, and free-text status values outside an allowed set 18:52
- Agent loops introduce Turing-completeness into AI systems, which is powerful but dangerous — loops can drift, go infinite, and accumulate token costs 13:42
Two Lineages: Agents and Ontologies
Coyle traces AI agents to the founding generation — John McCarthy, Marvin Minsky, Society of Mind — and the 1956 Dartmouth framing of AI as systems that perceive, decide, and act 2:21. Ontologies trace back to Aristotle's categories of being, were formalized philosophically by Quine, and received their canonical computational definition from Tom Gruber (1993): "a formal specification of a shared conceptualization" 3:39. Coyle frames ontologies as the mechanism for giving agents a machine-readable conceptualization of a domain 3:57.
Neurosymbolic AI as the Convergence Architecture
Coyle advocates neurosymbolic AI as the principled response to LLM probabilism 4:24. He is explicit that LLM hallucination is intrinsic: "That's the feature… we hallucinate in a way. We imagine things that may not exist, and then we turn them into reality" 5:02. No amount of prompt engineering closes this gap for high-stakes domains. The fix is to keep probabilistic reasoning inside the model while applying formal symbolic constraints outside it — specifically using RDFS inference rules and OWL constraint properties as guardrails 4:49.
He draws a direct historical parallel: the current agent + ontology architecture is a return to expert systems from the 1980s, the symbolic AI era he worked in directly 6:47. Expert systems failed not because the approach was wrong but because they couldn't scale; neural networks filled the scaling gap via GPU compute (crediting Nvidia's gaming GPU work as the accidental enabler) 7:30. Agentic AI now reunites both traditions.
What Ontologies Actually Are and How to Build Them
An ontology is a graph database of entities, properties, and relationships — more flexible than relational databases because new properties and relationships can be attached without schema migration 5:23. Two construction strategies exist 6:22:
- Top-down: domain experts enumerate entities (customers, purchase orders, support reps), their properties, and relationships — the classic expert-system method.
- Bottom-up: accumulate entities and relationships from observed domain activity and add them incrementally to the graph.
Coyle recommends reusing existing taxonomies rather than starting from scratch 9:07: schema.org for general terms, FOAF for social networks, Dublin Core for document metadata. He notes Wikipedia/DBpedia as a large-scale example of ontology-backed search already in production 8:54.
RDFS and OWL: Inference and Constraints
RDFS domain and range declarations enable inference: declaring that teaches has domain Teacher and range Student lets a reasoner infer class membership from a single triple 10:05. OWL extends this with:
- Transitive properties:
ancestor— if Sue is ancestor of Mary and Mary of Ann, Sue is ancestor of Ann 10:52 - Functional properties (cardinality = 1):
hasFather— asserting two different father values forces the reasoner to conclude they are the same individual 11:30 - Disjoint classes: customer and support representative are mutually exclusive types 19:27
- Enumerated value sets (
owl:oneOf): payment status must be exactly one of{paid, shipped, refunded}19:44
These constraints "sit on the side" of the graph and are not encoded in prose — they are executable logic 12:04.
The Claude Tool-Use Loop with an Ontology Validator
Coyle walks through a concrete tool use loop in Python 14:22:
- A
while Trueloop sends a prompt plus tool definition to the Claude API. - The model responds with a proposed tool call (parameters, not execution) and stops with
stop_reason = "tool_use". - The orchestrating code detects
tool_use, extracts parameters, and executes the tool. - Before feeding results back to the model, a validator — informed by the domain ontology — checks whether the result is semantically valid.
- If valid, the result re-enters the loop; if not, the loop either retries or escalates to a human.
Coyle highlights the validator injection point (marked in red in his slides) as precisely where ontology constraints apply 16:34. He stresses that agents should be side-effect-free until after ontology validation: "they're not running off doing something… changing things in the database not yet. You want to run them through the ontology first" 18:30.
Pydantic at the Door, Ontology at the Ledger
The two-layer validation strategy 17:47:
| Layer | Tool | What it checks |
|---|---|---|
| Input boundary | Pydantic | Type correctness of tool parameters (compensates for Python's dynamic typing) |
| Semantic result | Ontology reasoner (RDFS/OWL) | Domain validity — correct entity types, no constraint violations, allowed value sets |
Coyle's concrete error examples for what ontology catches that natural language cannot reliably prevent 18:52:
- Second refund on the same order — caught by a functional-property or cardinality constraint on
refund - Payout to support desk instead of buyer — caught by an OWL disjoint-class constraint between
CustomerandSupportRepresentative - Status value "probably shipped" — caught by an
owl:oneOfenumeration restricting status to{paid, shipped, refunded}
Coyle's closing argument: "use a reasoner built on ontology to keep the LLM on track, have guardrails to keep it honest" — with RDFS and OWL as the implementation substrate for those guardrails 20:05.