Python SDK for MemoryLayer — persistent memory infrastructure for AI agents
Project description
MemoryLayer Python SDK
Python client for MemorylAIer — persistent memory infrastructure for AI agents. Knowledge graph, semantic dedup, decay, and behavioral lessons at $0.001/call. No subscription.
Install
pip install memorylaier
Quick Start
from memorylaier import MemoryLayerClient
client = MemoryLayerClient(api_key="your-api-key")
# Store facts (auto-dedup, entity extraction, relationship graph)
client.store_facts([
{"text": "John Smith works at Acme Corp as a senior engineer"},
{"text": "Acme Corp is based in New York"},
])
# Semantic search with time-decay scoring
results = client.query("Where does John work?")
for m in results["memories"]:
print(f"{m['fact']} (score: {m['score']})")
# Hybrid search (vector + full-text) — best for entity names and exact terms
results = client.query("john@acme.com", hybrid=True)
# Knowledge graph traversal
graph = client.graph_traverse("John Smith", max_depth=2)
for edge in graph["edges"]:
print(f"{edge['source']} --{edge['predicate']}--> {edge['target']}")
# Temporal query: what did we know last month?
past = client.query("John Smith", as_of="2026-02-01T00:00:00Z")
# Extract facts from conversation
client.extract_conversation([
{"role": "user", "content": "My name is Alice and I work at Google"},
{"role": "assistant", "content": "Nice to meet you Alice!"},
])
# Behavioral lessons
client.add_lesson("Always confirm before making changes")
# Temporal triggers
client.set_trigger(
trigger_at="2026-03-10T09:00:00Z",
label="Follow up with John about the project",
)
client.close()
Features
- Semantic search with time-decay and access-count boosting
- Knowledge graph with auto-extracted relationships and multi-hop traversal
- Write gate quality scoring on every write
- Auto-dedup with supersession tracking
- Temporal queries — "what did we know at date X?"
- Conversation extraction — auto-extract facts from chat messages
- Behavioral lessons — self-improvement primitives
- Temporal triggers — scheduled memory surfacing
- Memory health monitoring
Authentication
Two auth paths — use whichever fits your setup:
- API key:
MemoryLayerClient(api_key="sk_...")— persistent integrations - x402 micropayments: USDC on Base, zero-signup — see docs
Pricing
| Operation | Price (USDC) |
|---|---|
| Write | $0.001 |
| Read | $0.0005 |
| Search | $0.001 |
Links
- Interactive API Docs
- OpenAPI Spec
- MCP Server —
npx memorylaier-mcp - GitHub
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
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 memorylaier-0.1.0.tar.gz.
File metadata
- Download URL: memorylaier-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43632509a3aee0851b3e0317de8236f0a479eefbc9b9594b8583c8c0ba03cec6
|
|
| MD5 |
eccdaf5c38ea9cfbf2db5a773461f4ca
|
|
| BLAKE2b-256 |
e2bc2c9387331e03331a6066ff16dc30c905c58561c167215494e0d443f2d83e
|
File details
Details for the file memorylaier-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memorylaier-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c09a8894e9ad13595fc273978777288584d000fa3ea93d41d44cbaa7aa070b7
|
|
| MD5 |
3116b97499b4c6fbf7f5420845f1936b
|
|
| BLAKE2b-256 |
69871b1fdb42aef8d96808806342cb42bf9ea5f9d2503b805a383e4271c41636
|