OpenZync Python SDK
Graph memory that survives production — the typed client for it.
Sync and async clients for OpenZync: typed models, automatic pagination, idempotency keys and LangChain integration over one HTTP transport.
PyPI · Docs · Core · MCP · Contact
Install
pip install openzync — Python 3.11+, Apache 2.0.
Quick start
from openzync import OpenZync
client = OpenZync(api_key="oz_live_your_api_key_here") # base_url defaults to http://localhost:8000
session = client.sessions.create(external_id="session-1")
resp = client.memory.ingest(
messages=[{"role": "user", "content": "Hi, I am Alice from Acme Corp."}],
session_id=session.external_id,
)
for hit in client.graph.search("Alice Acme Corp", types="episodes,facts"):
print(hit["content"], hit.get("score"))
Ingestion is asynchronous — the call returns a job and enrichment lands moments later. memory.ingest
is always sent as multipart/form-data, even for text-only payloads; the API rejects JSON there.
Async
import asyncio
from openzync import AsyncOpenZync
async def main() -> None:
async with AsyncOpenZync(api_key="...") as client:
await client.memory.ingest(messages=[{"role": "user", "content": "Hi"}], session_id="session-1")
asyncio.run(main())
Core surface
client.memory.ingest(messages=[...], session_id="s1") # episodes; idempotency key handled
client.memory.get_context(query="...") # context assembled for a prompt
client.facts.add(facts=[...], session_id="s1") # subject → predicate → object
client.facts.retract(fact_id, reason="corrected") # withdraw, keep the history
client.graph.search("query", types="episodes,facts") # hybrid search
client.users.create(external_id="alice") # users; list_iter() auto-paginates
memory, facts, graph, sessions, users, projects, search and four more domains cover
the API — every method is in the SDK reference.
Errors
from openzync._errors import NotFoundError, RateLimitError
try:
user = client.users.get("non-existent-id")
except NotFoundError:
print("User not found")
except RateLimitError:
print("Rate limited — slow down")
Every failure raises an OpenZyncError subclass mapped from the HTTP status; transport errors and
timeouts are separate classes, so you retry only what is safe.
Pagination
for user in client.users.list_iter(): fetches pages as it iterates (async for on the async client).
LangChain
pip install "openzync[langchain]"
OZChatMessageHistory keeps a conversation in OpenZync and takes an AsyncOpenZync client:
from openzync import AsyncOpenZync
from openzync.integrations.langchain import OZChatMessageHistory
client = AsyncOpenZync(api_key="...")
history = OZChatMessageHistory(session_id="session-1", client=client)
history.add_user_message("Hello!")
OZMemory, OZGraphRetriever and the graph/fact tools ship in the same extra — full reference.
Development
git clone https://github.com/openzync/openzync-python-sdk.git
cd openzync-python-sdk
pip install -e ".[dev]"
pytest # HTTP mocked with respx
License
Apache 2.0 — see LICENSE. If OpenZync is useful to you, a star helps others find it.
Metadata
Release files for openzync 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openzync-1.0.1.tar.gz | 46.0 kB | Without provenance | Details for openzync-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openzync-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for openzync-1.0.1-py3-none-any.whl |
Total release size: 113.4 kB
Release files / openzync-1.0.1.tar.gz
| Download URL | openzync-1.0.1.tar.gz |
|---|---|
| Size | 46.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
550f7678f53682ca2d02b42b49274a3547426b56012fe90b0fa03bdc86fc1396
|
|
BLAKE2b-256 checksum How to use checksums |
f2200af8dce881f47a13dccebe7bce5aa9167872c95481b22fe17b62fd017fa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / openzync-1.0.1-py3-none-any.whl
| Download URL | openzync-1.0.1-py3-none-any.whl |
|---|---|
| Size | 67.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e9240dd640dc6ddacd780f1389b8bf4091443b3805e6495249cc8b70fc73424
|
|
BLAKE2b-256 checksum How to use checksums |
4a152622ed308bb9b4300e58f96455bf2e5b8a963611bb5e4dd56ca56aec92f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for openzync 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.