Skip to main content

glyphh

Ada for Python: your models in Ada, wherever you run it (for example your own rrotor), called with an API key. Python 3.9 or later, no dependencies.

pip install glyphh
from glyphh import Ada, LimitError

ada = Ada()                     # GLYPHH_ADA_URL and GLYPHH_API_KEY from the environment
# or: Ada(url="https://ada.example.com", key="glyphh_ak_...")

d = ada.decide("tickets", {"ticket": {"what": {"plan": "pro", "text": "charged twice"}}})
if d.ask:                       # a person should decide: d.outcome is the best guess, for them to see
    send_to_a_person(d)
else:
    act(d.outcome)              # d.probabilities, d.expected_cost, d.receipts: the precedents it stands on

tickets = ada.model("tickets")
tickets.record({"ticket": {...}}, "refund")                     # a confirmed outcome: the next case learns from it

Where Ada answers is yours to set: no address is built in. Ada Cloud, the service Glyphh ran, is shut down; you point the SDK at where your Ada runs. The address is, in this order:

  1. the url= argument: Ada(url="https://ada.example.com");
  2. the GLYPHH_ADA_URL environment variable;
  3. the address glyphh login --url https://ada.example.com kept for this machine beside the key (below).

With none of them, Ada() raises AdaError with code E_CONFIG, and its message says these three ways; it never falls back to a default.

The key is made where your Ada runs; it acts in your org, with the clearance it was made with. With no key given or set (key=, then GLYPHH_API_KEY), Ada() uses the key glyphh login keeps for this machine.

The glyphh command

The package installs glyphh (also python -m glyphh): Ada from a terminal, for you, your scripts and CI, and agents with a shell such as Claude Code.

pipx install glyphh             # or: uv tool install glyphh, pip install glyphh
glyphh login --url https://ada.example.com   # paste an API key: checked against that Ada, then both are kept
glyphh whoami                   # which key, from where, Ada's address, and the org's plan

The key is the same API key the SDK takes. glyphh login keeps it, and the address beside it, 0600 for this machine in ~/.glyphh/credentials.json (--key-stdin reads the key from a pipe). The address login uses is --url, else GLYPHH_ADA_URL, else the one already kept, else it asks for it at the prompt. Every later command uses the same rule as the SDK: GLYPHH_ADA_URL when set, else the kept address; with neither, it refuses with E_CONFIG and says how to set one. GLYPHH_API_KEY, when set, wins over the kept key, which is the way for CI (with GLYPHH_ADA_URL). glyphh logout forgets both here; the key stays live until you revoke it where your Ada runs.

From nothing to a decision:

glyphh create tickets --spec @spec.json
glyphh import tickets history.csv --mapping '{"Plan": "ticket.what.plan", "Result": "outcome"}'
glyphh decide tickets '{"ticket": {"what": {"plan": "pro", "text": "charged twice"}}}'
glyphh record tickets @case.json --outcome refund        # a confirmed outcome: the next case learns from it
glyphh backtest tickets --candidates '[{"settings": {"word_evidence": 0}}]' --holdout '{"newest": 200}'
glyphh export tickets --to tickets.zip
Commands Do
login, logout, whoami, usage, releases The key; the plan's use this month; every Ada version
models, model, spec, create, delete The org's models; one; its spec (--set a new one); make one; delete one (--confirm NAME)
record, record-many, grade, forget, import Cases in: one, a JSON Lines file, an outcome later, one out, a whole history file
decide, query, probabilities, facts Ask
beam A chain of models: one model's outcome is the next model's question (--hops JSON, --width, --values, --miss)
learn, calibrate, backtest, settings, versions, activate, upgrade Tune, compare, roll back, move Ada versions
export, job, cancel Everything out; any job's state and stage (--wait); stop a job

Every answer is the API's own JSON on stdout, so it pipes into jq; a refusal is {"error": {code, message}} on stderr with exit code 1 (2 for a usage mistake). A JSON argument is the JSON itself, @file for a file's, or - for stdin's. Jobs are waited for, with progress on stderr (-q hides it, --no-wait answers the job at once). glyphh <command> --help says the rest.

From nothing to a decision

tickets = ada.create_model("tickets", spec)                     # the spec as JSON: layers, segments, roles, output
job = tickets.import_file("history.csv", mapping={"Plan": "ticket.what.plan", "Result": "outcome"},
                          on_progress=lambda j: print(j.state, j.percent))
print(job.result["added"], job.result["refused"], job.result["refusals"][:3])

bt = tickets.backtest([{"settings": {"word_evidence": 0}, "name": "no word evidence"}], holdout={"newest": 200})
print(bt.result["active"]["accuracy"], bt.result["candidates"][0]["change"])
tickets.settings({"word_evidence": 0}, note="cost 8% less on the last 200", backtest=bt.id)   # a new version
tickets.activate(1)                                            # and back
tickets.export(to="tickets.zip")                               # everything, as a zip: never locked in

Typed outputs and unions

On ada-1-2-beta, a named output's kind says what its answer is: score, noul, number, many or choice (the default), and when makes an output a branch of a union. Record each in its own terms; read what its kind adds:

tickets = ada.model("tickets")
tickets.record(data, outcomes={"kind": "billing", "refund": 120, "urgent": True, "tags": ["web"]})
d = ada.decide("tickets", data, outputs=["kind", "severity", "refund", "urgent", "tags"])
d.outputs["urgent"].p            # a noul's P(true)
d.outputs["refund"].value        # a number's expected value
d.outputs["severity"].applies    # False: a bug's severity does not arise for a billing case
d.outputs["tags"].outcome        # a many output's list

Ada versions

Every model version runs one Ada version, named ada-<major>-<minor> (-beta for a beta): ada-1-0 is the latest stable today, ada-1-1-beta a beta. A model's answers are always computed by its own Ada version; moving to another is your choice, made with a backtest in front of you.

for v in ada.ada.versions():                                   # newest first: name, status, dates, notes, your models on it
    print(v.name, v.status, v.ends, v.changes_answers, v.models)

tickets = ada.create_model("tickets", spec)                     # the latest stable; ada="ada-1-1-beta" to opt in to a beta
info = tickets.info()
print(info.ada, info.ada_status, info.ada_notice)              # ada-1-0 stable None; each of versions() has .ada too

bt = tickets.backtest(ada="ada-1-1-beta")                       # the active spec, learned and scored on that Ada
print(bt.result["active"]["cost"], "->", bt.result["candidates"][0]["cost"])
before = info.version
moved = tickets.upgrade("ada-1-1-beta", note="2 fewer wrong on the last 200", backtest=bt.id)   # a re-encode, waited for
tickets.activate(before)                                       # and back, on the Ada it ran before

upgrade() with no ada moves to the latest stable; an older version is a downgrade, allowed while it is kept. A beta is never the default. A deprecated version still answers until its end date, then the model is moved to the latest stable for you (never left unable to answer); while it runs one, or just after it was moved, the client warns AdaDeprecationWarning (once per client). A name refused is never substituted: AdaVersionUnknownError, AdaVersionRetiredError, AdaVersionDeprecatedError (for a new model or as an upgrade's target), AdaBetaClosedError, AdaVersionUnavailableError, each with ada and latest (the latest stable, the fix).

The SDK speaks contract SUPPORTED_CONTRACT (5) and was made against SUPPORTED_ADA (ada-1-0, ada-1-1-beta); newer names the server lists work as they are. A server that speaks a newer contract is refused, never read half-understood: ClientTooOldError (contract, supported), saying to pip install -U glyphh.

Ada decide(model, data, output=, outputs=, include=["facts"], clearance=) (POST /v1/decide); beam(start, hops, width=, values=, miss=, clearance=) (POST /v1/beam: a chain of models, one's outcome the next's question, one read per hop); models(), model(name), create_model(name, spec, ada=), delete_model(name); ada.versions(), ada.latest_stable(); job(id) (its stage: what it is doing now), wait(job, timeout=, on_progress=), cancel_job(job) (ends failed, E_CANCELLED; job.cancelled), download(job); usage()
Model info() (a ModelInfo: ada, ada_status, ada_notice), spec(), set_spec(spec, note=, backtest=), settings() and settings(changes, note=, backtest=), versions() (each with ada, kernel), activate(version), upgrade(ada=, note=, backtest=, wait=), delete(); record_many(cases) (a thousand a request, in chunks), grade(id, value, output=), forget(id); decide(data, ...); learn(), learn_job(), calibrate(), backtest(candidates, ada=, holdout=, output=); import_file(path or bytes, format=, mapping=, partial=, learn=), export(format=, to=)
Decision outcome, probabilities, expected_cost, ask, receipts, facts, outputs, model, version, ada; reads as 3.0's Result too (done, status, data)
Beam outcome (the heaviest end), p (its share of the mass that arrived), ends, paths (each end's likeliest path: value, p, trail_p, steps), lost, hops (each model, version), ada, data
AdaVersions latest_stable, contract, versions (each an AdaVersion: name, kernel, status, beta, open, released, deprecated, ends, changes_answers, aliases, summary, notes, models); iterates over the versions; get(name)
Job id, model, kind, state (awaiting, queued, running, done, failed), percent, result, error, download, upload; done, failed, ended
Usage plan, month (YYYY-MM, UTC), resets_at (YYYY-MM-DD), models, precedents (used, max), requests (used, max, over, overage: past the month metered on Basic, Pro and Team, refused on Free), requests_per_second; None is by contract, no cap
AdaError code, message, status, detail, retry_after, trace_id; typed by code: AuthError, LimitError (reason, used, max, plan, upgrade, resets_at), RateError (retry_after from Retry-After, max; waited out while the retry deadline allows), InvalidError, ModelMissingError, JobMissingError, SpecError, SpecLimitError, SpecReadingError, FewRolesError, MappingError, BusyError, NotReadyError, NoChangeError, IdempotencyError, VersionGoneError, AdaTimeoutError, UnavailableError, JobFailedError (a job that ended failed), AdaVersionError and its kinds (above), ClientTooOldError

Every call that runs long is a job, waited for with its progress unless wait=False. Every write carries an Idempotency-Key, so the client sends again what is safe to: a read, or a write, while Ada is unreachable for a moment (E_UNAVAILABLE, E_TIMEOUT, a 502 to 504), and anything refused with 429, with backoff and Retry-After, for up to Ada(retry_deadline=) seconds (default 30; 0: never).

SDK 3.0's calls still work: Model.record, query, facts, probabilities, learn and call(function, inputs) go through POST /v1/runs and answer a Result (run_id, status, data, ...). The cloud answers every run at once, so a decision never waits for input: it says ask.

The API and its answers' shapes are in contract/contract.json. Pin glyphh>=5: versions up to 2.6.7 are a different, older library, 3.x also carried what Glyphh no longer is (4.0 is Ada alone), and 3.2 to 4.0 called Glyphh's own Ada Cloud when no address was set. 5.0 is a breaking change: DEFAULT_URL is gone and there is no default address, so code that relied on it must set GLYPHH_ADA_URL, pass url=, or run glyphh login --url ... (see the changelog).

License

MIT (LICENSE).

Metadata

Release files for glyphh 5.0.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 5.0.0
File Size Uploaded Provenance Actions
glyphh-5.0.0.tar.gz 99.5 kB With provenance Details for glyphh-5.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 136.7 kB

Release files / glyphh-5.0.0.tar.gz

Download URL glyphh-5.0.0.tar.gz
Size 99.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0d5ab6cc4822b34ddc6741bc49e33c3acbdc8a297ddc2554e1629ddd5865809c
BLAKE2b-256 checksum
How to use checksums
baa400338b90a8749f3fa9abde7c0be4f65b235be61b60c23b828e2c824e3ebc
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 Dec 2, 2026.

Transparency log

Release files / glyphh-5.0.0-py3-none-any.whl

Download URL glyphh-5.0.0-py3-none-any.whl
Size 37.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49daf8420ec0749e63359b862d709dbc93d3024de14d8916dacd12a9289f9bd3
BLAKE2b-256 checksum
How to use checksums
cc8eb77ed730666859bc0066be02202ffb434eb348031e951dfa8a8fc08bedb7
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 Dec 2, 2026.

Transparency log

Security for glyphh 5.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for glyphh-5.0.0.tar.gz

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 Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

5.0.0 This release

2 release files Full provenance

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