Skip to main content

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.

License

MIT

Metadata

Release files for velixar 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for velixar 1.0.3
File Size Uploaded
velixar-1.0.3.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for velixar 1.0.3
File Interpreter ABI Platform
velixar-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.0 kB

Release files / velixar-1.0.3.tar.gz

Download URL velixar-1.0.3.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f5ddc793d95e3a9306f6015d50b838079ff8f457a115f956a0b99327592404e3
BLAKE2b-256 checksum
How to use checksums
d15c2bf968982cb95dfa414382a4c619f2d80dfcaee909b1e230d8f329b84b6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / velixar-1.0.3-py3-none-any.whl

Download URL velixar-1.0.3-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7e69a23d01c52f68e83c8cda14c15fd02ade9e0763da013ad659077ab64db60
BLAKE2b-256 checksum
How to use checksums
22b5dcbcfdcc0823f6b318764957f5ad116c7d86a2899976d4930382a118081d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page