Ancient ground for modern agents. Minimal setup for long-term memory, auto feedback loop, agents CI/CD, auto tracing, and API serving.
Project description
Zin
Ancient ground for modern agents. Minimal setup for long-term memory, auto feedback loop, agents CI/CD, auto tracing, and API serving.
Install
pip install zin
Quick start
import asyncio
from zin import ZinMemory
async def main():
async with ZinMemory("http://localhost:8000") as client:
# Add a memory
mem_id = await client.add("Prefers dark mode", user_id="user-1")
# Search by semantic similarity
results = await client.search("UI preferences", user_id="user-1")
for r in results:
print(r.text, r.distance)
# Process a conversation — the memory agent extracts and stores
# relevant facts automatically (fire-and-forget on the server)
await client.process_memory(
messages=[
("user", "I just moved to Berlin"),
("assistant", "Nice! How are you settling in?"),
],
user_id="user-1",
)
asyncio.run(main())
API reference
ZinMemory(base_url, timeout=10.0)
Async client for the Zin memory server. Use as an async context manager or call close() when done.
await client.add(text, *, user_id=None, namespace="personal", metadata=None) -> str
Store a memory. Returns the memory ID.
| Parameter | Type | Description |
|---|---|---|
text |
str |
The memory content |
user_id |
str | None |
Scopes to personal_<user_id> namespace |
namespace |
str |
Target namespace (default: "personal") |
metadata |
dict | None |
Arbitrary metadata stored with the memory |
await client.search(query, *, user_id=None, namespace=None, top_k=5) -> list[SearchResult]
Semantic similarity search over stored memories.
| Parameter | Type | Description |
|---|---|---|
query |
str |
Natural language search query |
user_id |
str | None |
Scope search to user's personal namespace |
namespace |
str | None |
Search a specific namespace |
top_k |
int |
Max results to return (default: 5) |
Returns a list of SearchResult objects with id, text, metadata, namespace, and distance fields.
await client.process_memory(messages, *, user_id=None, namespaces=None, store_personal=True) -> None
Send a conversation window to the memory agent. The agent analyzes the conversation and autonomously creates, updates, or deletes memory records.
| Parameter | Type | Description |
|---|---|---|
messages |
list[tuple[str, str]] |
Conversation as (role, content) tuples |
user_id |
str | None |
User ID for personal namespace scoping |
namespaces |
dict[str, str] | None |
Shared namespaces, e.g. {"company": "Company knowledge"} |
store_personal |
bool |
Whether the agent can store personal memories (default: True) |
await client.list_memories(*, namespace=None, limit=100) -> list[Memory]
List stored memories without vector search. Useful for debugging.
await client.delete_all_memories() -> int
Delete all memories. Returns the count of deleted records.
Namespaces
Zin uses a two-level namespace system:
- Personal (
personal): Private per-user memory, resolved topersonal_<user_id>on the server. This is the default namespace. - Shared: Named namespaces passed via
namespacesdict (e.g.{"company": "Company-wide knowledge"}). The memory agent decides which namespace to use based on content.
When searching without specifying a namespace, the search is scoped to the user's personal namespace (privacy-first default).
Requirements
- Python >= 3.11
- A running Zin server
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zin-0.0.5.tar.gz.
File metadata
- Download URL: zin-0.0.5.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79eefa1b21b7ae909d4d3fd2d822081afbe78f2656b55d0aa6e4775d5806e94b
|
|
| MD5 |
289c72be61baa76ef4a9caa0f42124e4
|
|
| BLAKE2b-256 |
a15f78a6e8831c86a40dd745a896c504d1bddf97226d055f8c6689d2b2c45dc8
|
Provenance
The following attestation bundles were made for zin-0.0.5.tar.gz:
Publisher:
publish.yml on galsalo/zin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zin-0.0.5.tar.gz -
Subject digest:
79eefa1b21b7ae909d4d3fd2d822081afbe78f2656b55d0aa6e4775d5806e94b - Sigstore transparency entry: 1154688367
- Sigstore integration time:
-
Permalink:
galsalo/zin@22fff27c4e80d8bd05c06b1dcaccaf4de8c9f2c3 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/galsalo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22fff27c4e80d8bd05c06b1dcaccaf4de8c9f2c3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file zin-0.0.5-py3-none-any.whl.
File metadata
- Download URL: zin-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed762fc746e7c44cdf88a88dd9d58bd27bd0d53411f2dc118e6d341e178aba1c
|
|
| MD5 |
5cffa48c6d69635e177385db7e0d915b
|
|
| BLAKE2b-256 |
4638f88a195a084c8100a0229420762a0970f68758b0e5d23fb5f1f260a6ad94
|
Provenance
The following attestation bundles were made for zin-0.0.5-py3-none-any.whl:
Publisher:
publish.yml on galsalo/zin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zin-0.0.5-py3-none-any.whl -
Subject digest:
ed762fc746e7c44cdf88a88dd9d58bd27bd0d53411f2dc118e6d341e178aba1c - Sigstore transparency entry: 1154688369
- Sigstore integration time:
-
Permalink:
galsalo/zin@22fff27c4e80d8bd05c06b1dcaccaf4de8c9f2c3 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/galsalo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22fff27c4e80d8bd05c06b1dcaccaf4de8c9f2c3 -
Trigger Event:
push
-
Statement type: