Skip to main content

glyphh-ada

Ada for Python. An agent builds an Ada model: its types, its records, its rules. This package is what your software calls to use it. Every answer is typed, the same input always gives the same answer, and no language model is in the path.

Docs: docs.glyphh.ai/ada. No dependencies on Python 3.11 and later. Python 3.9 or later.

pip install glyphh-ada

Ask a model

from glyphh_ada import Ada

ada = Ada()  # GLYPHH_API_KEY from the environment
tickets = ada.model("am_0123456789ab")

answer = tickets.query({"ticket": {"issue": {"component": "kubelet", "symptom": "crash_on_boot"}}})

if answer["act"]:
    route(answer["top"])
elif answer["reason"] == "unseen":
    ask_someone(answer["unseen"])  # ["ticket.issue.component=etcd"]

act is the one thing to branch on. When it is false, reason says why, and the nearest answer and the records behind it are still there. When Ada acts covers every case.

An answer is the JSON the server sent, as a dictionary. The package's TypedDicts (Answer, Facts, History, Trend, Prediction, Edges, GqlResult) say what is in each, so a type checker knows the keys.

Record what happened

tickets.record({"ticket": {"issue": {"component": "kubelet", "symptom": "crash_on_boot", "severity": 7}}}, "route_to_platform")
tickets.veto(situation, "route_to_network")  # this outcome failed here
tickets.record(situation, "route_to_platform", at="2026-01-03T10:00:00Z")  # when it happened, for past records

Create a typed model

model = ada.create_model("tickets", spec={
    "name": "tickets",
    "layers": [{"name": "ticket", "segments": [{"name": "issue", "roles": [
        {"name": "component", "type": "category"},
        {"name": "severity", "type": "number", "numeric_config": {"min_value": 0, "max_value": 10, "bin_width": 1}},
    ]}]}],
})
print(model.id)

Data that does not fit a role's type is refused before it is stored or scored.

Everything a model does

Method Returns
query(situation) The answer: act, reason, top, unseen, receipts
facts(situation, top=3) The nearest situations as fact trees: which parts matched, and how closely
check(situation, outcome) How close the nearest win and failure of one outcome are
record(situation, outcome, at=None), veto(...) The record's id, key and version
history(thing) Every version of a thing, each with what changed
trend(thing) How far it has moved, how fast, and each number's slope
predict(thing, at=None) Its next version, and what the model's other things say of it
edges(thing, level=None, top=None) Its nearest neighbours at a level, the change between versions, and its relations
gql(query, args=None) One GQL statement: FIND SIMILAR, LIST, COUNT, AGGREGATE, COMPARE, DETECT DRIFT, INTROSPECT, TREND, PREDICT, FOLLOW, PATH
call(name, args=None) A stored procedure
procedures(), save_procedure(name, query), delete_procedure(name) Stored procedures
info(), update(...), delete() The model itself
records(...), edit_record(id, ...), delete_record(id) Its records
calibrate(), learn() Fit its probabilities; learn which keys or roles decide
contract() The JSON Schema of every answer and of a typed model's data

On the client: ada.models(), ada.create_model(...), ada.devices(), ada.contract(), and ada.op(name, **args) for any operation by name.

GQL and the graph

near = tickets.gql("FIND SIMILAR TO $like WHERE outcome = $outcome LIMIT 5", {"like": situation, "outcome": "won"})
for match in near["matches"]:
    print(match["key"], match["score"])

impact = services.gql('FOLLOW glyph("db") IN DEPTH 3')  # everything that depends on db

Worked examples

Two programs that go from an empty model to a function your software calls, each with a step-by-step guide: route support tickets (Python) and customer churn (TypeScript). The source is in examples/.

Errors

A refusal is an AdaError with a code, a message, the HTTP status, and retry_after when Ada says how long to wait.

from glyphh_ada import AdaError

try:
    tickets.query({"ticket": {"issue": {"severity": "high"}}})
except AdaError as e:
    if e.code == "E_VALIDATION":
        print(e.message)  # situation: ticket.issue.severity: a numeric role takes a finite number
Code Means
E_VALIDATION An argument, or data that does not fit the model's types
E_NOT_FOUND No such model, record, thing or procedure
E_FORBIDDEN For org admins, or above the reader's clearance
E_FAILED_PRECONDITION The model cannot do that as it is
E_UNAUTHENTICATED, E_PAYMENT The key, or the organization's plan or budget
E_RATE_LIMITED Too many calls for the plan. retry_after says how many seconds to wait
E_UNREACHABLE The request never got an answer

Options

Ada(api_key=None, base_url=None, timeout=30.0, headers=None, transport=None)

api_key defaults to GLYPHH_API_KEY, base_url to GLYPHH_URL and then https://api.glyphh.ai. transport is a function (url, headers, body, timeout) -> (status, body) or (status, body, response headers): give your own to use another HTTP library. The client is synchronous; call it from a thread in async code. Create a key on the Virtual Keys page of the Glyphh console. Every call is metered on your organization's plan.

License

MIT

Metadata

Release files for glyphh-ada 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glyphh-ada 0.1.1
File Size Uploaded
glyphh_ada-0.1.1.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glyphh-ada 0.1.1
File Interpreter ABI Platform
glyphh_ada-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / glyphh_ada-0.1.1.tar.gz

Download URL glyphh_ada-0.1.1.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0ca93a5819655ab7c31b13d2302659d092242f1ede4b0c442523f1d253010276
BLAKE2b-256 checksum
How to use checksums
ebf8969ae8f7e50fa74504b7442c2c9f97ce6bd1bf300e03a2bd7cc68836e02f
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 Oct 2, 2026.

Transparency log

Release files / glyphh_ada-0.1.1-py3-none-any.whl

Download URL glyphh_ada-0.1.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b518cc2f73fa57afd557df52b99afc52c4b436ebd05f0bc76bfb04f87d98e0f9
BLAKE2b-256 checksum
How to use checksums
3690e047dd2e677a4ea5ad84b80d1ed4a7d8ce6aabfc8accd9ac4a898f122b1c
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 Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page