Skip to main content

Persistent memory infrastructure for AI applications

Project description

Velixar Python SDK

PyPI Python License

Persistent memory for AI assistants and agents. Give any LLM-powered application long-term recall across sessions.

Velixar is an open memory layer — it works with any AI assistant, agent framework, or LLM pipeline. Store facts, preferences, and context that persist beyond a single conversation.

Installation

pip install velixar

# With LangChain integration
pip install velixar[langchain]

# With LlamaIndex integration
pip install velixar[llamaindex]

# All integrations
pip install velixar[all]

Quick Start

from velixar import Velixar

v = Velixar(api_key="vlx_your_key")  # Or set VELIXAR_API_KEY env var

# Store a memory
memory_id = v.store(
    content="User prefers dark mode and metric units",
    tier=0,  # 0=pinned, 1=session, 2=semantic (default), 3=org
    user_id="user_123",
    tags=["preferences"],
)

# Search memories semantically
results = v.search("user preferences", limit=5)
for memory in results.memories:
    print(f"[{memory.score:.2f}] {memory.content}")

# Get context for LLM prompts
context = v.get_context("What are the user's preferences?", max_tokens=2000)

Async Support

from velixar import AsyncVelixar

async with AsyncVelixar(api_key="vlx_...") as v:
    await v.store("User's favorite color is blue", user_id="user_123")
    results = await v.search("favorite color")

Memory Tiers

Tier Name Use Case
0 Pinned Critical facts, user preferences, never expire
1 Session Current conversation context
2 Semantic Long-term memories (default)
3 Organization Shared team knowledge (Hivemind+)
from velixar import MemoryTier

v.store("User is allergic to peanuts", tier=MemoryTier.PINNED)
v.store("Currently discussing project X", tier=MemoryTier.SESSION)

Cognitive Features by Plan

Feature Free Cortex ($29) Synapse ($75) Hivemind ($25/seat)
Store & search
Neural ensembles
Temporal chains
Consolidation
Identity modeling
Org memory (tier 3)

Free tier stores and searches memories. Paid tiers activate cognitive features automatically — no code changes needed. Pricing →

Use With Any AI Assistant

Velixar is assistant-agnostic. Plug it into OpenAI, Anthropic, LangChain, LlamaIndex, custom agents, or any LLM pipeline:

# Inject memories as context before calling your LLM
results = v.search(user_message, limit=5)
context = "\n".join(m.content for m in results.memories)

response = openai.chat.completions.create(
    model="gpt-4",
    messages=[
        {"role": "system", "content": f"Relevant memories:\n{context}"},
        {"role": "user", "content": user_message},
    ],
)

# Store important facts after the conversation
v.store("User prefers concise answers", user_id="user_123")

LangChain Integration

from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables.history import RunnableWithMessageHistory
from velixar.integrations.langchain import VelixarChatMessageHistory

def get_session_history(session_id: str):
    return VelixarChatMessageHistory(session_id=session_id, api_key="vlx_...")

chain = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant."),
    MessagesPlaceholder(variable_name="history"),
    ("human", "{input}"),
]) | ChatOpenAI()

with_history = RunnableWithMessageHistory(
    chain, get_session_history,
    input_messages_key="input",
    history_messages_key="history",
)

# Memory persists across sessions, restarts, and deployments
config = {"configurable": {"session_id": "user_123"}}
with_history.invoke({"input": "I prefer Python over JavaScript"}, config=config)
with_history.invoke({"input": "What language do I prefer?"}, config=config)

LlamaIndex Integration

from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI
from velixar.integrations.llamaindex import VelixarMemory

memory = VelixarMemory(api_key="vlx_...", user_id="user_123")
agent = ReActAgent.from_tools(tools=[...], llm=OpenAI(), memory=memory)

Batch Operations

result = v.store_many([
    {"content": "Fact 1", "tier": 0},
    {"content": "Fact 2", "tier": 2, "tags": ["important"]},
    {"content": "Fact 3", "user_id": "user_456"},
])

Error Handling

from velixar import VelixarError, RateLimitError, AuthenticationError

try:
    v.store("test")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except VelixarError as e:
    print(f"Error: {e.message}")

Configuration

v = Velixar(
    api_key="vlx_...",           # Or VELIXAR_API_KEY env var
    base_url="https://...",      # Custom endpoint (optional)
    timeout=30.0,                # Request timeout in seconds
    max_retries=3,               # Retry attempts for failures
)

Get an API Key

Sign up at velixarai.com and generate a key under Settings → API Keys.

Related

License

MIT

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

velixar-1.0.2.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

velixar-1.0.2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file velixar-1.0.2.tar.gz.

File metadata

  • Download URL: velixar-1.0.2.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for velixar-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b8385db41a5d99dcf3b52812615d8eec3c133e47fe5da2ff5ecc673dbe10d13c
MD5 8ed6606de3a7610afebeb9e1bf8cb081
BLAKE2b-256 a85f8259e4b18409d9171d99a0cce2ee523660d872ed3cf2875bbd99e09e5c25

See more details on using hashes here.

File details

Details for the file velixar-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: velixar-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for velixar-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c12d95f346f093d531a261799e4a0fe95f16c41962d7d361280cbd48fd21dc4f
MD5 f7d54dc6f02eef1be922159886b4ac98
BLAKE2b-256 1ecc1fda0b906f8414da0f7c014ee1bd1e8e4b5feeb6536cee1a2edef51d1c8f

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