ontary — a domain-agnostic ontology SDK
Declare an ontology once — typed objects, links, actions, functions, and a security policy — and get a governed runtime: scope- and sensitivity-aware reads, audited business-verb actions, and an MCP server for AI agents. The engine stays domain-agnostic; the tickets example is just one small domain.
Python 3.12+ · pydantic-only core · mypy --strict · offline make verify.
Release metadata: version
0.10.0, store schema v9. Releases are annotated tags (v0.10.0).
Install
From PyPI:
uv add "ontary[mcp,postgres,dlt]==0.10.0"
or pin it in pyproject.toml:
[project]
dependencies = ["ontary[mcp,postgres,dlt]==0.10.0"]
The extras are optional: mcp serves the ontology to AI agents, postgres
adds the PostgresStore backend, and dlt adds the connector pipeline. The
core needs only pydantic.
Without an index, install the tagged git ref instead (exact tag, no patch updates):
uv add "ontary @ git+https://github.com/ryoochi0112/ontary@v0.10.0"
Quickstart
This short runnable path uses a support-ticket domain. The complete
Org → Queue → Ticket → Comment ontology, connectors, effects, functions, and
runnable MCP stdio and effects-drain examples are in
examples/tickets/.
from ontary import (
ActionContext, ActionError, ActionParams, Consumer, DirectProperty,
ObjectStore, Ontology, OntologyObject, Source, prop, target,
)
ontology = Ontology(name="tickets", scope_levels=["queue"])
@ontology.object(
layer="L0", owned={"escalated": False},
scope=[DirectProperty(level="queue", property_name="queue_id")],
)
class Ticket(OntologyObject):
id: str = prop(primary_key=True)
subject: str
queue_id: str = prop(scope_level="queue")
escalated: bool | None = prop(default=False)
class EscalateTicket(ActionParams):
ticket_id: str = target(Ticket)
@ontology.action(
EscalateTicket, target=Ticket, roles=["Agent"],
display_name="Escalate ticket", description="Mark a ticket urgent.",
api_name="EscalateTicket",
)
def escalate(ctx: ActionContext, params: EscalateTicket) -> dict[str, str]:
if ctx.read_current("Ticket", params.ticket_id) is None:
raise ActionError("ticket does not exist", code="PRECONDITION_FAILED")
ctx.update("Ticket", params.ticket_id, {"escalated": True})
return {"ticket_id": params.ticket_id}
ontology.validate()
store = ObjectStore(ontology.registry)
ticket_id = store.insert(
"Ticket", {"subject": "Invoice mismatch", "queue_id": "queue-a"},
Source(source_system="demo"),
)
client = ontology.bind(store).for_consumer(
Consumer(actor_id="agent-1", role="Agent", scope_level="queue",
scope_id="queue-a", kind="human")
)
ticket = client.get(Ticket, ticket_id)
assert ticket is not None and ticket.subject == "Invoice mismatch"
client.execute(EscalateTicket(ticket_id=ticket_id))
assert client.get(Ticket, ticket_id).escalated is True
Where to go
| Learn about | Destination |
|---|---|
| Authoring an ontology | Ontology design guide |
| オントロジー設計 | 日本語ガイド |
| Look up names and errors | API reference · error-code table |
| API リファレンス | 日本語リファレンス |
| Storage and tenancy | Storage, tenancy, and schema |
| Connectors | Connectors and canonical staging |
| MCP serving | MCP serving |
| Governed effects | Governed capabilities and effects |
| Queries and pagination | Queries, typed reads, and pagination |
| Authority and architecture | Authority, declarations, and architecture |
| Cookbook recipes | Cookbook |
| Compatibility and migration | CHANGELOG.md · Compatibility |
| v1 release gate | v1.0.0 acceptance gate |
License
MIT — see LICENSE. ontary continues the ontos SDK, which
Atrae, Inc. authored and released to the author for open-source development.
Metadata
Release files for ontary 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ontary-0.10.0.tar.gz | 1.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ontary-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / ontary-0.10.0.tar.gz
| Download URL | ontary-0.10.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb517513fa3d7c920b32b2d68c6374e41ce5465bb662a2bb37f4a06999c98104
|
|
BLAKE2b-256 checksum How to use checksums |
d038030653e5a44cb5f023f886ead9e5210430ef52035b32213842e46661d0d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logRelease files / ontary-0.10.0-py3-none-any.whl
| Download URL | ontary-0.10.0-py3-none-any.whl |
|---|---|
| Size | 283.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6491656b774d6e737d55a634741552823f49080e57711782453eb4ebee3d4985
|
|
BLAKE2b-256 checksum How to use checksums |
b292101f9f32b87be13ead93be766d765224be32e74e2e499c64ecfece218ead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency log