Skip to content

Ontologies for AI Agents: From Product Surface to Typed Tools

Documentation is not the only knowledge that was written for humans. Every product with a scripting API, a file format, or a multi-step workflow has the same problem: the surface is powerful, but nothing about it tells an AI agent what is safe to call, in what order, with which units.

Hand an agent a list of function names and it will guess. It will pass millimetres where metres are expected, call a post-processing step before the solve has run, and overwrite a results file because nothing said it could. These are not model failures. They are modeling failures, and an ontology is the fix.

The idea in one diagram

Describe the product once, as a graph. Derive everything an agent needs from it.

flowchart LR
  O[("Ontology<br/>OWL schema")] --> G{{"Product graph<br/>operations, parameters,<br/>artifacts, prerequisites"}}
  G --> V["SHACL + graph checks<br/>reject incomplete descriptions"]
  G --> P["SPARQL<br/>plan and impact analysis"]
  G --> T["Generated tool definitions<br/>JSON Schema + annotations"]
  T --> M["MCP server"]
  M --> A(["AI agent"])
  P --> M

The graph is the single source of truth. Tool schemas, workflow plans, documentation, and quality scores are derived, so nothing is maintained twice and nothing drifts.

What the ontology has to say

Four kinds of fact turn a pile of functions into something an agent can use safely.

1. Operations and their prerequisites. Each callable step is an Operation. A transitive requiresOperation property records what must run first. An agent that asks "what do I need before running the solver?" gets the full ordered chain from one SPARQL property path, not from guesswork.

2. Parameters with units, bounds, and allowed values. A parameter is not "a number". It is a number in millimetres, between 0.1 and 500, with a sensible default. These facts become the JSON Schema the agent sees, and they let the server reject global_size = 0.01 with a message that names the unit and the limit.

3. Data artifacts. Operations consume and produce typed artifacts (a mesh, a set of solution fields). This gives you data lineage, and it lets the server refuse a call whose inputs do not exist yet, instead of failing somewhere deep inside the product.

4. Side effects. Is the operation destructive? Idempotent? Read-only? Long running? These flags map directly onto the annotations in the Model Context Protocol (destructiveHint, idempotentHint, readOnlyHint), which clients use to decide when to ask a human first. If a fact is not in the graph, it cannot reach the agent, so the validation layer makes these flags mandatory.

From graph to tool

Each operation becomes one tool definition. The ontology supplies the types, the ranges, and the warnings; a short generator does the rest:

{
  "name": "generate_mesh",
  "description": "Builds a volume mesh around the clean geometry ... Run first: repair_geometry. Produces: Mesh. Note: long running.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "global_size": { "type": "number", "minimum": 0.1, "maximum": 500,
                        "description": "Target element edge length away from the surface. Unit: mm." }
    },
    "required": ["global_size"],
    "additionalProperties": false
  }
}

Note what the description does. It tells the model when to choose the tool, what must come before it, and what it costs. Descriptions are the part of the interface the model actually reads, so the ontology treats a thin description as an error, not a style problem.

Errors an agent can recover from

An agent cannot ask a colleague what went wrong. Make the error carry the answer: a stable code, the violated constraint with its unit, and a next step.

{
  "error": "missing_prerequisite",
  "message": "predict_with_surrogate needs SurrogateModel, which does not exist in this session yet",
  "hint": "call ontology_plan_workflow with goal='predict_with_surrogate' to get the ordered steps"
}

The hint points at an ontology-aware tool that returns the plan, so recovery needs no human. Meta-tools like this one (list operations, describe an operation, plan a workflow, analyse impact) are what let an agent reason about the product before acting on it.

Validate the description before you ship it

An ontology is only as good as its completeness. SHACL turns completeness into a check:

  • every operation has a description of at least 40 characters, a declared output, and explicit destructive, idempotent, and long-running flags
  • every numeric parameter has a unit, and every enum lists its allowed values
  • every required parameter carries a realistic example, used in generated docs and tests

Some rules do not fit a shape, so a graph check covers them: prerequisite cycles (a workflow nobody can run), artifacts that are consumed but never produced, and defaults that fall outside their own bounds.

An agentic-readiness rubric

When you review a product's surface for agents, score each operation on the same questions:

Check Question
Description Is it specific enough for a model to pick this tool and not a neighbour?
Parameters Is every parameter described, typed, and unit-bearing?
Bounds Does every numeric input declare a safe range?
Enums Are allowed values listed rather than implied?
Side effects Are destructive, idempotent, and long-running behaviours declared?
Outputs Is there a typed output a later step can depend on?
Prerequisites Is every consumed artifact's producer a declared prerequisite?

Weighting these gives a score per operation and a list of findings per product. It is a review aid for ontology authors. It is not a measure of how often an agent will succeed; that needs the evaluation work described in Evaluating Graph Retrieval.

Where this runs

SimOnto implements every step above: an OWL schema, SHACL shapes, SPARQL planning, generated tool definitions, a readiness scorer, and a dependency-free MCP server, with automated tests including an end-to-end protocol test. Its demo product is fictional and its backend is simulated, and the repository says so. What is real is the pipeline, and it carries over unchanged when you point it at a different product description.

Takeaway

An agent is only as safe as the interface it can discover. If the facts that make a call safe (units, ranges, order, side effects) live only in people's heads, the agent will violate them. Put them in an ontology, validate the ontology, and generate the interface from it. The same discipline that makes content findable for people makes capabilities callable for machines.