Persistent memory for AI agents — Kronvex Python SDK
Project description
Kronvex Python SDK
Persistent memory for AI agents. Three endpoints, one API key, production-ready.
Installation
pip install kronvex
Quick start
from kronvex import Kronvex
kx = Kronvex("kx_your_api_key")
agent = kx.agent("your-agent-id")
# Store a memory
agent.remember("User prefers concise answers", memory_type="preference")
# Recall relevant memories
memories = agent.recall("what does the user prefer?", top_k=5)
for m in memories:
print(f"[{m['score']:.2f}] {m['content']}")
# Inject context into your prompt
context = agent.inject_context("How should I respond?")
# → "Relevant memories:\n- User prefers concise answers\n..."
Async support
import asyncio
from kronvex import AsyncKronvex
async def main():
async with AsyncKronvex("kx_your_api_key") as kx:
agent = kx.agent("your-agent-id")
await agent.remember("User is based in Paris", memory_type="semantic")
memories = await agent.recall("where is the user?")
asyncio.run(main())
With LangChain
from kronvex import Kronvex
from langchain_openai import ChatOpenAI
kx = Kronvex("kx_your_api_key")
agent = kx.agent("your-agent-id")
def chat(user_message: str, session_id: str) -> str:
# Inject past context
context = agent.inject_context(user_message, session_id=session_id)
llm = ChatOpenAI(model="gpt-4o")
response = llm.invoke([
{"role": "system", "content": f"You are a helpful assistant.\n\n{context}"},
{"role": "user", "content": user_message},
])
# Store the exchange
agent.remember(f"User: {user_message}", memory_type="episodic", session_id=session_id)
agent.remember(f"Assistant: {response.content}", memory_type="episodic", session_id=session_id)
return response.content
API reference
Kronvex(api_key, *, base_url, timeout)
| Method | Description |
|---|---|
.agent(agent_id) |
Get an Agent handle |
.create_agent(name) |
Create a new agent |
.list_agents() |
List all agents |
Agent
| Method | Description |
|---|---|
.remember(content, *, memory_type, session_id, ttl_days, pinned, metadata) |
Store a memory |
.recall(query, *, top_k, memory_type, session_id, threshold) |
Semantic search |
.inject_context(message, *, top_k, session_id) |
Get prompt-ready context block |
.sessions() |
List session IDs |
.memories(*, session_id, memory_type, limit, offset) |
List stored memories |
.delete_memory(memory_id) |
Delete one memory |
.clear() |
Delete all memories |
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.2.0.tar.gz
(8.4 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
kronvex-0.2.0-py3-none-any.whl
(12.4 kB
view details)
File details
Details for the file kronvex-0.2.0.tar.gz.
File metadata
- Download URL: kronvex-0.2.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
489bcec6954d9f51377823c61c7e7d437d6671c6affd69b812ac970d9331d59d
|
|
| MD5 |
c7ce86ed1df7d67296207af60cae1bae
|
|
| BLAKE2b-256 |
7caf5986d0a2f62b72607cd771a2466e89f9169bd5ed1a84addedf3ae5843575
|
File details
Details for the file kronvex-0.2.0-py3-none-any.whl.
File metadata
- Download URL: kronvex-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66dab700a7810f4170c09e680afc177fd4612532caff49cb4344e4368ab964a3
|
|
| MD5 |
25d4cba2698517be2af5abf417ef4ffe
|
|
| BLAKE2b-256 |
e9520d058e2d51b91b98b87cb199f0fbfd4a767c651aa9660d9f0720c840e71d
|