Skip to main content

omnigraph

Async Python client for the Omnigraph HTTP API, contract 0.14. It mirrors the TypeScript SDK @modernrelay/omnigraph: the same routes, the same contract checks, and the same error model, with Python names.

pip install omnigraph

Connect and query

from omnigraph import Omnigraph

async with Omnigraph("http://127.0.0.1:8080", graph_id="knowledge", token=TOKEN) as og:
    result = await og.query(
        "query find($name: String) { match { $p: Person { name: $name } } return { $p.name, $p.age } }",
        params={"name": "Alice"},
    )
    print(result["rows"], result["graph_commit_id"])

base_url is the server root, including any proxy prefix. Select a graph with graph_id or og.graph("beta"), which shares the connection pool. Results are the server's JSON as TypedDicts generated from the server's OpenAPI document; field names are the wire names. Rows omit null-valued fields.

Every request carries Omnigraph-Http-Api: 0.14, every response is checked for it, and a HEAD /healthz discovery precedes each data request. The client follows no redirects and never retries.

Versions

The package's major.minor is the HTTP contract it speaks: omnigraph 0.14.x talks to omnigraph-server 0.14.x and refuses any other contract. The patch number is the SDK's own, for fixes that change nothing on the wire, so omnigraph 0.14.1 does not mean server 0.14.1. Upgrade the server and this package together when the minor changes, and pin omnigraph>=0.14,<0.15 to follow SDK fixes for one contract.

Write and verify

changed = await og.mutate(
    "query rename($old: String, $name: String) { update Person set { name: $name } where name = $old }",
    params={"old": "Alice", "name": "Alicia"},
    if_graph_commit=result["graph_commit_id"],
)

A successful mutation returns its commit receipt; commit: None is a successful no-op. With if_graph_commit the conditional route refuses a moved head with PreconditionFailedError.

Branches, merges, and unpublished commits:

await og.branches.create("review")
await og.mutate(insert_query, params=..., branch="review")
merged = await og.branches.merge("review", delete_branch=True)

Merge and mutation receipts are validated; a receipt that does not name the requested operation raises ApiContractError.

Streams, loads, feeds, and blobs

# NDJSON, not buffered
async for row in og.export(type_names=["Person"]):
    ...
# One commit, up to 32 MiB
await og.load_ndjson(ndjson_text, branch="main", mode="merge")
# One bounded feed page
page = await og.changes.poll(start="beginning", limit=100)
# A snapshot, then {"baseline": ...}
async for record in og.changes.baseline():
    ...
await og.blobs.put(b"...", entity="node", type="Doc", id="d1", property="body")
await og.queries.invoke("people", params={"name": "Ada"})

Ordinary JSON requests are limited to 1 MiB by the server; bulk loads go through load_ndjson.

Errors

Every error is an OmnigraphError subclass chosen by status and code (ConflictError, PreconditionFailedError, PayloadTooLargeError, GraphUnavailableError, ...). Each carries:

  • disposition: the server's effects (none, partial, unknown) and next action;
  • request_dispatched: whether the request may have reached the server;
  • outcome_unknown: a write may have taken effect — reconcile before retrying.

The token never appears in a repr or an error message.

Cluster deployments

og.cluster.plan/apply/status/get_deployment submit and observe captured deployment bundles. Bundles are opaque here, as in the TypeScript SDK; for operator work use omnigraph cluster plan/apply --target NAME --config DIR.

Development

uv sync
uv run pytest                      # unit tests (mocked transport)
OMNIGRAPH_TEST_SERVER=1 OMNIGRAPH_BIN_DIR=/path/to/v0.14.0 uv run pytest tests/test_e2e.py
uv run python scripts/generate.py --check   # generated files match spec/openapi.json
uv run mypy && uv run ruff check . && uv run ruff format --check .

spec/openapi.json is the pinned server release's document (scripts/sync_spec.py fetches it for the version in [tool.omnigraph]); scripts/generate.py regenerates _models.py and _version.py from it.

Metadata

Release files for omnigraph 0.14.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 omnigraph 0.14.0
File Size Uploaded Provenance Actions
omnigraph-0.14.0.tar.gz 145.4 kB With provenance Details for omnigraph-0.14.0.tar.gz

Built distribution (wheel)

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

Total release size: 172.5 kB

Release files / omnigraph-0.14.0.tar.gz

Download URL omnigraph-0.14.0.tar.gz
Size 145.4 kB
Tags Source
SHA-256 checksum
How to use checksums
941fb0f751bea7ff0e68af89df82279b6073070c4fe2bf5b73b8fa788b898016
BLAKE2b-256 checksum
How to use checksums
5e283d21fbc5aeb195046fb1fd00ed49464f9db745353436f48fc37ad2effa9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

Release files / omnigraph-0.14.0-py3-none-any.whl

Download URL omnigraph-0.14.0-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dc7bd47e7544f5c0163a9c409c7b323b174894c672be0a9fed80a3eae943537
BLAKE2b-256 checksum
How to use checksums
934edb24ade26fbe4831e526ea6122490d8a8a7b0faf9231586bcbf3c50b40da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

Security for omnigraph 0.14.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 omnigraph-0.14.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 Nov 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.

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