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.
For LangChain retrievers, tools, message history, and context wrappers:
pip install langchain-openvikingFor the LangGraph store and middleware:
pip install "langchain-openviking[langgraph]"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",
auth_mode="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()For API-key-only integrations, pass auth_mode="api_key" alongside api_key.
The authentication mode is forwarded to owned synchronous and asynchronous SDK
clients, including clients rebuilt during safe-read recovery. Leaving it unset
preserves the SDK's existing configuration defaults. The same option is available
on the recorder, retriever, message history, store, tools, and context wrappers.
The package also provides OpenVikingSessionRecorder,
OpenVikingContextMiddleware, OpenVikingStore,
OpenVikingChatMessageHistory, and create_openviking_tools.
create_openviking_tools includes viking_rule_search in the retrieval, agent,
and admin profiles. Pass task_context and optionally rule_probability_threshold
(default 0.65) to check compiled constraints before an action or response.
It returns the full rendered Rules without truncation. Use an SDK client exposing
rule_search and a server with POST /api/v1/rules/search; an error must not be
treated as no applicable Rules.
- 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.
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 OpenVikingRetrieverSee the OpenViking documentation, examples, and the framework adapter guide.
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.pyPackage metadata and source headers declare AGPL-3.0; see LICENSE. The runnable examples retain Apache-2.0.