Skip to main content

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                        # core SDK
pip install "kronvex[langchain]"           # + LangChain integration
pip install "kronvex[crewai]"              # + CrewAI integration
pip install "kronvex[langgraph]"           # + LangGraph integration
pip install "kronvex[openai-agents]"       # + OpenAI Agents SDK integration
pip install "kronvex[autogen]"             # + AutoGen integration
pip install "kronvex[all-integrations]"    # all integrations at once

Quick start

from kronvex import Kronvex

kx = Kronvex("kv-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("kv-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())

Framework integrations

LangChain

pip install "kronvex[langchain]"
from kronvex.integrations.langchain import KronvexMemory
from langchain_openai import ChatOpenAI
from langchain.chains import ConversationChain

memory = KronvexMemory(api_key="kv-your-key", agent_id="your-agent-id")
chain = ConversationChain(llm=ChatOpenAI(), memory=memory)
chain.predict(input="I prefer concise answers.")

CrewAI

pip install "kronvex[crewai]"
import os
os.environ["KRONVEX_API_KEY"] = "kv-your-key"
os.environ["KRONVEX_AGENT_ID"] = "your-agent-id"

from kronvex.integrations.crewai import recall_memory, store_memory, get_context
from crewai import Agent

researcher = Agent(role="Researcher", goal="...", tools=[recall_memory, store_memory])

LangGraph

pip install "kronvex[langgraph]"
from kronvex.integrations.langgraph import make_recall_node, make_store_node

recall_node = make_recall_node("kv-your-key", "your-agent-id")
store_node  = make_store_node("kv-your-key", "your-agent-id")

builder.add_node("recall", recall_node)
builder.add_node("store",  store_node)

OpenAI Agents SDK

pip install "kronvex[openai-agents]"
from agents import Agent, Runner
from kronvex.integrations.openai_agents import KronvexHooks

hooks = KronvexHooks(api_key="kv-your-key", agent_id="your-agent-id", session_id="user-42")

result = await Runner.run(
    agent,
    messages=[{"role": "user", "content": "Hello"}],
    hooks=hooks,
)

AutoGen

pip install "kronvex[autogen]"
from kronvex.integrations.autogen import KronvexMemory

mem = KronvexMemory(api_key="kv-your-key", agent_id="your-agent-id")

context = mem.inject_context(user_message)
system_msg = f"You are a helpful assistant.\n\n{context}"

mem.remember(f"User: {user_message}")
mem.remember(f"Assistant: {ai_response}")

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.5.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kronvex-0.5.2-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file kronvex-0.5.2.tar.gz.

File metadata

  • Download URL: kronvex-0.5.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for kronvex-0.5.2.tar.gz
Algorithm Hash digest
SHA256 9b13f8fab0eb194da67e88afd92ed0f8b1e5710bdb595d2e87a36696984bbe3a
MD5 e6388bbe201787b39e598d52fe0becbb
BLAKE2b-256 950fd4254e77120a1f9b344d263101dc7a9c6a65a5d0f50eff1bd295d3c6a67d

See more details on using hashes here.

File details

Details for the file kronvex-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: kronvex-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for kronvex-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8eadd05e6a4256a60992c962bade5ee4f20c908146d90de1b428d1236ca24aa
MD5 408b093a279fde51afa4aaa65cfc028e
BLAKE2b-256 2e764b70d98fa3152a4f17b1d81b4b2217d31d133f0eb0fde50e6e52a7700d08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page