Persistent memory layer for AI agents
Project description
Kronvex Python SDK v0.3.0
Persistent memory layer for AI agents — REST API wrapper with sync + async support.
Install
pip install kronvex # sync only (zero deps)
pip install kronvex[async] # + async support via httpx
Quick start
from kronvex import Kronvex
kx = Kronvex(api_key="kx_live_...", agent_id="<uuid>")
# Store a memory
kx.remember("User prefers concise answers and uses Python 3.11")
# Recall relevant memories
results = kx.recall("user coding preferences")
for r in results:
print(f"[{r.confidence:.2f}] {r.memory.content}")
# Inject context into your prompt
ctx = kx.inject_context("What language should I use?")
system_prompt = str(ctx) + "\n\nYou are a helpful assistant."
Environment variables
export KRONVEX_API_KEY="kx_live_..."
export KRONVEX_AGENT_ID="<uuid>"
kx = Kronvex() # reads from env
TTL & pinned memories (v0.3.0)
# Memory expires in 30 days
kx.remember("Temporary session note", ttl_days=30)
# Pinned memory never expires
kx.remember("User's name is Alice", pinned=True)
# Confidence score on recall results
results = kx.recall("user name")
print(results.best().confidence) # 0.0–1.0 composite score
Session filtering
# Store with session
kx.remember("User asked about pricing", session_id="session_abc")
# Recall within session only
results = kx.recall("pricing questions", session_id="session_abc")
# List all sessions
sessions = kx.list_sessions()
# [{"session_id": "session_abc", "count": 12}, ...]
Async (FastAPI, async frameworks)
from kronvex import AsyncKronvex
async def handler(user_message: str):
async with AsyncKronvex(api_key="kx_live_...", agent_id="<uuid>") as kx:
ctx = await kx.inject_context(user_message)
return str(ctx)
Full API
| Method | Description |
|---|---|
remember(content, *, memory_type, session_id, metadata, ttl_days, pinned) |
Store a memory |
recall(query, *, top_k, threshold, session_id, memory_type) |
Semantic recall |
inject_context(message, *, top_k, threshold) |
Context block for system prompt |
create_agent(name, description) |
Create a new agent |
list_agents() |
List all agents |
list_sessions(agent_id) |
List session IDs with memory counts |
delete_memory(memory_id) |
Delete one memory |
Error handling
from kronvex import Kronvex, AuthError, RateLimitError, KronvexError
try:
kx.remember("...")
except AuthError:
print("Invalid API key")
except RateLimitError:
print("Slow down!")
except KronvexError as e:
print(f"API error {e.status_code}: {e}")
Links
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
kronvex-0.3.0.tar.gz
(6.2 kB
view details)
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 kronvex-0.3.0.tar.gz.
File metadata
- Download URL: kronvex-0.3.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01b6ff064a17c7f57600e92e9589eaa619551ede273602e84674e3ff7362df1d
|
|
| MD5 |
33d4428f06a3e813bcdc191d650cd2ba
|
|
| BLAKE2b-256 |
60484bdbcc86c37c2e9db6c87ba6a0cd6bb8099daa6cc26b4d37259d979cb79d
|
File details
Details for the file kronvex-0.3.0-py3-none-any.whl.
File metadata
- Download URL: kronvex-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fce49fc2e2aa77a1499e222354408824a6bf37507a547f90c8298f5e7a1221a0
|
|
| MD5 |
b5c39a1a7ed77586d6c0aaa0e255f24a
|
|
| BLAKE2b-256 |
bec92bb5090585596c1306aff67db33f70b5f0743888353c7966f8ccec16574a
|