Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
langchain-openviking
Working memory is now opt-in. Update installed plugins separately from the OV server, then restart the host. Existing explicit settings still take precedence. See the default-off upgrade guide for native history, re-enabling WM, and old-conversation handoffs.
langchain-openviking is the official OpenViking integration package for
LangChain and LangGraph applications. It keeps framework-specific adapters
separate from the OpenViking server and communicates with remote OpenViking
instances through the lightweight openviking-sdk package.
OpenViking Server requirement: examples here use the
viking://~home alias (for exampleviking://~/memories), which the server expands to the authenticated caller's own user space, so they require a server withviking://~support. The uid-lessviking://user/memoriesshorthand is rejected by newer servers; pass an explicitviking://user/<uid>/...URI when targeting another user.
Installation
For LangChain retrievers, tools, message history, and context wrappers:
pip install langchain-openviking
For the LangGraph store and middleware:
pip install "langchain-openviking[langgraph]"
Quick start
from langchain_openviking import OpenVikingRetriever
from openviking_sdk import SyncHTTPClient
client = SyncHTTPClient(
url="http://127.0.0.1:1933",
api_key="your-user-api-key",
)
client.initialize()
retriever = OpenVikingRetriever(
client=client,
target_uri="viking://~/memories",
)
try:
documents = retriever.invoke("What deployment preferences should I remember?")
finally:
client.close()
The package also provides OpenVikingSessionRecorder,
OpenVikingContextMiddleware, OpenVikingStore,
OpenVikingChatMessageHistory, and create_openviking_tools.
Client ownership
- A client supplied through
client=orasync_client=remains caller-owned. - Clients created from
url=are managed by the adapter and can be closed withclose()oraclose()as documented by each adapter.
Import migration
Starting with the next server release after v0.5.0, the legacy
openviking.integrations.langchain namespace is removed without a compatibility
shim. v0.5.0 still provides it. Install the standalone package and import from
langchain_openviking instead; see the Unreleased migration notes.
from langchain_openviking import OpenVikingRetriever
See the OpenViking documentation, examples, and the framework adapter guide.
Validate
From the repository root:
pip install -e 'integrations/frameworks/langchain[langgraph,test,dev]'
python -m pytest -q --noconftest -o addopts='' \
integrations/frameworks/langchain/tests tests/unit/test_langchain_package_boundary.py
Package metadata and source headers declare AGPL-3.0; see LICENSE. The runnable examples retain Apache-2.0.