LangGraph integration for Hindsight - persistent memory tools, nodes, and store for AI agents
Project description
hindsight-langgraph
LangGraph and LangChain integration for Hindsight — persistent long-term memory for AI agents.
Provides three integration patterns:
- Tools — retain/recall/reflect as LangChain
@toolfunctions for agent-driven memory. Works with both LangChain and LangGraph. - Nodes (LangGraph) — pre-built graph nodes for automatic memory injection and storage
- BaseStore (LangGraph) — drop-in
BaseStoreadapter for LangGraph's built-in memory system
Prerequisites
- A running Hindsight instance (self-hosted via Docker or Hindsight Cloud)
- Python 3.10+
Installation
pip install hindsight-langgraph
Quick Start: Tools
Bind Hindsight memory tools to your LangGraph agent so it can store and retrieve memories on demand.
from hindsight_client import Hindsight
from hindsight_langgraph import create_hindsight_tools
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
client = Hindsight(base_url="http://localhost:8888")
tools = create_hindsight_tools(client=client, bank_id="user-123")
agent = create_react_agent(
ChatOpenAI(model="gpt-4o"),
tools=tools,
)
result = await agent.ainvoke(
{"messages": [{"role": "user", "content": "Remember that I prefer dark mode"}]}
)
Quick Start: Memory Nodes
Add recall and retain nodes to your graph for automatic memory injection before LLM calls and storage after responses.
from hindsight_client import Hindsight
from hindsight_langgraph import create_recall_node, create_retain_node
from langgraph.graph import StateGraph, MessagesState, START, END
client = Hindsight(base_url="http://localhost:8888")
recall = create_recall_node(client=client, bank_id="user-123")
retain = create_retain_node(client=client, bank_id="user-123")
builder = StateGraph(MessagesState)
builder.add_node("recall", recall)
builder.add_node("agent", agent_node) # your LLM node
builder.add_node("retain", retain)
builder.add_edge(START, "recall")
builder.add_edge("recall", "agent")
builder.add_edge("agent", "retain")
builder.add_edge("retain", END)
graph = builder.compile()
Dynamic Bank IDs
Use bank_id_from_config to resolve the bank per-request from the graph's config:
recall = create_recall_node(client=client, bank_id_from_config="user_id")
retain = create_retain_node(client=client, bank_id_from_config="user_id")
# Bank ID resolved at runtime
result = await graph.ainvoke(
{"messages": [{"role": "user", "content": "hello"}]},
config={"configurable": {"user_id": "user-456"}},
)
Quick Start: BaseStore
Use Hindsight as a LangGraph BaseStore for cross-thread persistent memory with semantic search.
from hindsight_client import Hindsight
from hindsight_langgraph import HindsightStore
client = Hindsight(base_url="http://localhost:8888")
store = HindsightStore(client=client)
graph = builder.compile(checkpointer=checkpointer, store=store)
# Store and search memories via the store API
await store.aput(("user", "123", "prefs"), "theme", {"value": "dark mode"})
results = await store.asearch(("user", "123", "prefs"), query="theme preference")
Configuration
Global config
from hindsight_langgraph import configure
configure(
hindsight_api_url="http://localhost:8888",
api_key="your-api-key", # or set HINDSIGHT_API_KEY env var
budget="mid",
tags=["source:langgraph"],
)
Per-call overrides
All factory functions accept client, hindsight_api_url, and api_key to override the global config.
| Parameter | Description | Default |
|---|---|---|
hindsight_api_url |
Hindsight API URL | https://api.hindsight.vectorize.io |
api_key |
API key (or HINDSIGHT_API_KEY env var) |
None |
budget |
Recall budget: low, mid, high |
mid |
max_tokens |
Max tokens for recall results | 4096 |
tags |
Tags applied to retain operations | None |
recall_tags |
Tags to filter recall results | None |
recall_tags_match |
Tag matching: any, all, any_strict, all_strict |
any |
Requirements
- Python 3.10+
langchain-core >= 0.3.0hindsight-client >= 0.4.0langgraph >= 0.3.0(only for nodes and store patterns — install withpip install hindsight-langgraph[langgraph])
Documentation
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 hindsight_langgraph-0.1.2.tar.gz.
File metadata
- Download URL: hindsight_langgraph-0.1.2.tar.gz
- Upload date:
- Size: 151.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a720a6d4cdd8fa83431f300eaececac0ada38c30f24e637b80d8764265dc80a0
|
|
| MD5 |
f626ccc39f3594369ec8707f11973c94
|
|
| BLAKE2b-256 |
c21894c578fcaca21ae3b44e18c6f78dd4a684287fe3615302d1e53b77aec93d
|
Provenance
The following attestation bundles were made for hindsight_langgraph-0.1.2.tar.gz:
Publisher:
release-integration.yml on vectorize-io/hindsight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hindsight_langgraph-0.1.2.tar.gz -
Subject digest:
a720a6d4cdd8fa83431f300eaececac0ada38c30f24e637b80d8764265dc80a0 - Sigstore transparency entry: 1306284832
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@a5f8b58ab5dc702cdcc6eebfbb1df6b0e918ccb5 -
Branch / Tag:
refs/tags/integrations/langgraph/v0.1.2 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@a5f8b58ab5dc702cdcc6eebfbb1df6b0e918ccb5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hindsight_langgraph-0.1.2-py3-none-any.whl.
File metadata
- Download URL: hindsight_langgraph-0.1.2-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6db0a90fb3a573ae6d4e20700dbf2626ce4fbf67487012937f795c1e0c55fec
|
|
| MD5 |
6b24a22c0e65b032c55701ce2dac5113
|
|
| BLAKE2b-256 |
52797f75195ed58ae7a88e1f484a7584636a8b470f965cdc79f909e72dc2baf1
|
Provenance
The following attestation bundles were made for hindsight_langgraph-0.1.2-py3-none-any.whl:
Publisher:
release-integration.yml on vectorize-io/hindsight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hindsight_langgraph-0.1.2-py3-none-any.whl -
Subject digest:
a6db0a90fb3a573ae6d4e20700dbf2626ce4fbf67487012937f795c1e0c55fec - Sigstore transparency entry: 1306284915
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@a5f8b58ab5dc702cdcc6eebfbb1df6b0e918ccb5 -
Branch / Tag:
refs/tags/integrations/langgraph/v0.1.2 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@a5f8b58ab5dc702cdcc6eebfbb1df6b0e918ccb5 -
Trigger Event:
push
-
Statement type: