Aivery Python SDK
AI memory that understands time — temporal-tree retrieval for LLM agents.
from aivery import Memory
m = Memory()
m.add("I love hiking on weekends", user_id="alice")
results = m.search("outdoor activities", user_id="alice")
Why Aivery?
Most memory systems store facts as a flat list. Aivery organizes memories into a temporal tree: related memories are parent/child, time flows from root to leaf, contradictions fork into branches. Retrieval walks the tree — you get a coherent branch of context, not a bag of facts.
Compared to mem0 on the LOCOMO benchmark (LLM judge score, higher = better):
| System | LLM Score |
|---|---|
| mem0 (platform) | 0.5571 |
| Aivery (tree + heatmap, K=50) | 0.6773 |
| Aivery (wide retrieval, K=200→50) | 0.8000 |
Installation
pip install aivery
Requires an Aivery API key. Point AIVERY_BASE_URL at https://api.aivery.systems or a self-hosted instance.
Quickstart
from aivery import Memory
m = Memory()
# Add from a plain string
m.add("I'm training for a marathon in April", user_id="alice")
# Add from a conversation
m.add(
[
{"role": "user", "content": "I just moved to San Francisco."},
{"role": "assistant", "content": "Welcome! How are you finding it?"},
],
user_id="alice",
)
# Search
results = m.search("where does alice live?", user_id="alice")
# [{"memory": "Alice lives in San Francisco", "score": 0.94, "id": "..."}]
# Get a context block for LLM injection
ctx = m.context("what do I know about alice?", user_id="alice")
# "- Alice is training for a marathon in April\n- Alice lives in San Francisco"
Drop-in OpenAI agent
import os
from openai import OpenAI
from aivery import Memory
openai = OpenAI()
memory = Memory()
def chat(message: str, user_id: str) -> str:
ctx = memory.context(message, user_id=user_id, top_k=10)
system = "You are a helpful assistant."
if ctx:
system += f"\n\nWhat you remember about the user:\n{ctx}"
response = openai.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": system},
{"role": "user", "content": message},
],
)
answer = response.choices[0].message.content
memory.add(
[{"role": "user", "content": message}, {"role": "assistant", "content": answer}],
user_id=user_id,
)
return answer
Async
from aivery import AsyncMemory
async with AsyncMemory() as m:
await m.add("I love jazz", user_id="alice")
results = await m.search("music preferences", user_id="alice")
Configuration
| Method | Description |
|---|---|
Memory() |
Reads AIVERY_BASE_URL, AIVERY_API_KEY, AIVERY_ORG_ID from environment |
Memory(host="http://...") |
Explicit host |
Memory(api_key="aiv_...") |
Explicit API key |
Environment variables:
AIVERY_BASE_URL=https://api.aivery.systems # default
AIVERY_API_KEY=aiv_... # required
AIVERY_ORG_ID=00000000-... # multi-tenant org scoping
Hosted API
Use the Aivery hosted API at https://api.aivery.systems — no setup required.
Reproducing the LOCOMO benchmark
The numbers in the table above were produced using the LOCOMO dataset and the evaluation harness from mem0. The benchmark/ directory in this repo contains the Aivery integration scripts — see benchmark/README.md for full instructions.
Cost breakdown: Ingestion and answer generation run through your Aivery plan (server-side LLM — no key needed on your end). The LLM judge step requires your own OpenAI key and costs ~$5 for the full 1,540-question set. A Pro tier or higher is recommended for ingestion throughput.
Self-hosting
Self-hosting docs and a one-command Docker setup are coming soon.
License
MIT
Metadata
Release files for aivery 0.1.0
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 | |
|---|---|---|---|---|
| aivery-0.1.0.tar.gz | 21.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aivery-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.2 kB
Release files / aivery-0.1.0.tar.gz
| Download URL | aivery-0.1.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
887de4d59e37eb277906a0de3add1072fc6cda7217637687b4fde9d306822c39
|
|
BLAKE2b-256 checksum How to use checksums |
07acdfc4cc75bad3e70f98b31dfb7466e07f9e8e0ad5956da6fe3183b5dbc7e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / aivery-0.1.0-py3-none-any.whl
| Download URL | aivery-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5afe7a64f2bbd3e40cadb8ea5d2323e783c0869413d6507319db17edd22264b
|
|
BLAKE2b-256 checksum How to use checksums |
efe8bf995a36d1e6fa0f0d788c0a6aeff58c12ca85ce2a848a95073866c073bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for aivery 0.1.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.
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.