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
tickets.load([{"situation": h.situation, "outcome": h.outcome, "at": h.when} for h in history])  # the seed, all or none
tickets.stream(read_records("tickets.ndjson"))  # a file, streamed; a refusal names the line and says how many landed (error.loaded)

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
load(records) Up to 500 records in one call, all or none; a longer list goes in turns. {loaded, wins, vetoes}
stream(records) A file of records as NDJSON to POST /ada/load, sent as it is read and written in batches as it arrives
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.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.2.0

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.2.0
File Size Uploaded
glyphh_ada-0.2.0.tar.gz 15.4 kB Details

Built distribution (wheel)

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

Total release size: 29.0 kB

Release files / glyphh_ada-0.2.0.tar.gz

Download URL glyphh_ada-0.2.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
547f0f3a4b91c7da9b31f3047aa1f30faacd5105b6ae309b041fe1cd724c0fb0
BLAKE2b-256 checksum
How to use checksums
5e6cf7d94d6e857f3cdcadaadb44415efec07c26fc78df05fe6dd4088f4c4fbf
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 3, 2026.

Transparency log

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

Download URL glyphh_ada-0.2.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd8ff61e6d30012c40daf50f643eec31e7b7a5eed69186cb80ffd0212cf2608c
BLAKE2b-256 checksum
How to use checksums
64df1627d4bfefa2e0ce0a1483b3e71506adbb5bf53690360907c05cf12e3e06
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 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

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