LangChain integration for HippoDid — persistent character memory for AI agents
Project description
langchain-hippodid
Persistent character memory for LangChain agents — powered by HippoDid.
Add cloud-persistent, character-scoped memory to any LangChain chain in a few lines.
Install
pip install langchain-hippodid
Quick Start
from langchain_anthropic import ChatAnthropic
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables.history import RunnableWithMessageHistory
from langchain_hippodid import HippoDidMemory
memory = HippoDidMemory(api_key="hd_...", character_id="your-character-uuid")
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful assistant."),
MessagesPlaceholder(variable_name="history"),
("human", "{input}"),
])
chain_with_memory = RunnableWithMessageHistory(
prompt | ChatAnthropic(model="claude-sonnet-4-20250514"),
memory.get_history,
input_messages_key="input",
history_messages_key="history",
)
chain_with_memory.invoke(
{"input": "My name is Yang, I'm building SameThoughts"},
config={"configurable": {"session_id": "default"}},
)
# Memory persists to HippoDid cloud — survives restarts, redeploys, everything.
Why HippoDid?
| Feature | Default LangChain | HippoDidMemory |
|---|---|---|
| Persistence | In-process only | Cloud-persistent across sessions |
| Scope | Global | Character-scoped (one per user) |
| Retrieval | Flat chat log | Semantic search across structured categories |
| Context assembly | Append all messages | Profile + category summaries + relevant facts |
| LLM provider | N/A | Works with any provider (BYOK) |
External ID Pattern — One Character Per User
Auto-create and resolve characters by your system's user ID:
from langchain_hippodid import HippoDidMemory
def get_memory(user_id: str) -> HippoDidMemory:
return HippoDidMemory(
api_key="hd_...",
external_id=user_id, # Auto-creates character if first time
)
memory = get_memory("user_yang_001")
Memory Modes
| Mode | Behavior | Best For |
|---|---|---|
VERBATIM |
Stores exact message text, zero AI cost | Chat history replay |
EXTRACTED |
AI extracts structured facts via AUDN pipeline | Long-term user knowledge |
HYBRID |
Both verbatim archive and extracted facts | Full fidelity + structured recall |
memory = HippoDidMemory(
api_key="hd_...",
character_id="...",
memory_mode="EXTRACTED",
)
Advanced: Custom Search & Context Assembly
Use HippoDidChatMessageHistory directly for fine-grained control:
from langchain_hippodid import HippoDidChatMessageHistory
history = HippoDidChatMessageHistory(
api_key="hd_...",
character_id="your-character-uuid",
)
# Semantic search across memories
results = history.search("travel preferences", top_k=5)
# Assemble full context (profile + memories) for a system prompt
context = history.get_context("current user preferences")
Links
- HippoDid — Persistent memory for AI agents
- Documentation
- GitHub
- PyPI
- hippodid Python SDK
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_hippodid-0.1.0.tar.gz.
File metadata
- Download URL: langchain_hippodid-0.1.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
589705d46eea4b62ec7e4d45b6177eac89379c389b99ad5a382d5ae6432fcae7
|
|
| MD5 |
25594aae2f27cd99f9e30e9d9f001744
|
|
| BLAKE2b-256 |
813f9b91f944aed632f5212ca545fc6aac80642bddfc2d0bdea4b5e25e3a78f4
|
Provenance
The following attestation bundles were made for langchain_hippodid-0.1.0.tar.gz:
Publisher:
ci.yml on SameThoughts/langchain-hippodid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_hippodid-0.1.0.tar.gz -
Subject digest:
589705d46eea4b62ec7e4d45b6177eac89379c389b99ad5a382d5ae6432fcae7 - Sigstore transparency entry: 1244342951
- Sigstore integration time:
-
Permalink:
SameThoughts/langchain-hippodid@351b2c64531c1de0bf428d95a4ead8fcf50fa8a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SameThoughts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@351b2c64531c1de0bf428d95a4ead8fcf50fa8a1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_hippodid-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_hippodid-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71785230cde0ff3c7b7790064a4b4abc88bda16b47870d1c8a1ceaa17108c94e
|
|
| MD5 |
cbf52a9223fafbe6b0d30ffbb2d22354
|
|
| BLAKE2b-256 |
2978dd04ab6bbb02b26858254be664532c3777290969b96cefcbd2565a29a83a
|
Provenance
The following attestation bundles were made for langchain_hippodid-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on SameThoughts/langchain-hippodid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_hippodid-0.1.0-py3-none-any.whl -
Subject digest:
71785230cde0ff3c7b7790064a4b4abc88bda16b47870d1c8a1ceaa17108c94e - Sigstore transparency entry: 1244342958
- Sigstore integration time:
-
Permalink:
SameThoughts/langchain-hippodid@351b2c64531c1de0bf428d95a4ead8fcf50fa8a1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SameThoughts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@351b2c64531c1de0bf428d95a4ead8fcf50fa8a1 -
Trigger Event:
push
-
Statement type: