Can create_react_agent and supervisor_agent in langgraph be modified ? to use Store/Checkpoint for persistent memory - ie Postgre in Langgraph’s backend when grapgs deployed to langgraph platform
I believe the following pages might be helpful to you:
opened 04:56PM - 03 Jan 25 UTC
closed 07:13AM - 07 Jan 25 UTC
### Checked other resources
- [X] This is a bug, not a usage question. For ques… tions, please use GitHub Discussions.
- [X] I added a clear and detailed title that summarizes the issue.
- [X] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- [X] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.
### Example Code
```python
DB_URI = "postgresql://ai_user:xxxxxxx@x.x.x.x:5432/ai_sessions?sslmode=disable"
connection_kwargs = {
"autocommit": True,
"prepare_threshold": 0,
}
conn=Connection.connect(DB_URI, **connection_kwargs)
in_memory_store=InMemoryStore()
postgres_store=PostgresStore(conn)
namespace=("memory", "user_2")
key=("user_memory")
in_memory_store.put(namespace,key,"This is a test message")
print("======Output of GET from In-Memory Store=======")
print(in_memory_store.get(namespace,key))
postgres_store.put(namespace,key,"This is a test message for checking PostgresStore")
print("======Output of GET from Postgres Store=======")
print(postgres_store.get(namespace,key))
```
### Error Message and Stack Trace (if applicable)
```shell
======Output of GET from In-Memory Store=======
Item(namespace=['memory', 'user_2'], key='user_memory', value='This is a test message', created_at='2025-01-03T16:53:36.133867+00:00', updated_at='2025-01-03T16:53:36.133867+00:00')
======Output of GET from Postgres Store=======
None
```
### Description
When I try to run PostgresStore GET method, it returns an empty value. However, I can see the value exists in backend database (added by PUT method):
ai_sessions=> select * from store;
prefix | key | value | created_at | updated_at
---------------+-------------+-----------------------------------------------------+-------------------------------+-------------------------------
memory.user_2 | user_memory | "This is a test message for checking PostgresStore" | 2025-01-03 16:53:35.239496+00 | 2025-01-03 16:53:35.239496+00
### System Info
System Information
------------------
> OS: Windows
> OS Version: 10.0.22631
> Python Version: 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]
Package Information
-------------------
> langchain_core: 0.3.28
> langchain: 0.3.13
> langchain_community: 0.3.13
> langsmith: 0.1.125
> langchain_anthropic: 0.3.0
> langchain_cohere: 0.3.4
> langchain_experimental: 0.3.4
> langchain_groq: 0.2.0
> langchain_huggingface: 0.1.0
> langchain_ollama: 0.2.0
> langchain_openai: 0.2.2
> langchain_postgres: 0.0.9
> langchain_text_splitters: 0.3.4
> langserve: 0.3.0
Other Dependencies
------------------
> aiohttp: 3.11.10
> anthropic: 0.39.0
> async-timeout: Installed. No version info available.
> cohere: 5.13.4
> dataclasses-json: 0.6.7
> defusedxml: 0.7.1
> fastapi: 0.115.0
> groq: 0.10.0
> httpx: 0.27.0
> httpx-sse: 0.4.0
> huggingface-hub: 0.25.0
> jsonpatch: 1.33
> numpy: 1.24.4
> ollama: 0.3.3
> openai: 1.58.1
> orjson: 3.10.7
> packaging: 23.2
> pandas: 1.5.3
> pgvector: 0.2.5
> psycopg: 3.2.1
> psycopg-pool: 3.2.2
> pydantic: 2.10.3
> pydantic-settings: 2.5.2
> PyYAML: 6.0.2
> requests: 2.32.3
> sentence-transformers: 3.1.1
> SQLAlchemy: 2.0.34
> sqlalchemy: 2.0.34
> sse-starlette: 2.1.3
> tabulate: 0.9.0
> tenacity: 9.0.0
> tiktoken: 0.7.0
> tokenizers: 0.19.1
> transformers: 4.44.2
> typing-extensions: 4.12.2
Hi @johnda98 ! When deployed with LangSmith Deployments, we default to using postgres for short term and long term memory today.
1 Like
yes.. was aware of that. ie Postgres for production deploys on langgraphie now langsmith deploys…
SQL Lite use if langgraph deploys to localhost ? i presume.
More importantly my question asks if the create_react_agent and supervisor_agent in langgraph be modified ? as runnable configs so they can use Store and Checkpointer ie to have interthread Long Term memory via sqllite or postgres.
I think those Agent graphs are buried in the langgraph API and currently do not have long term memory capability ??
yes can create my own Agent but was using Langgraph’s Supervisor Agent and subAgent - tools agent.. via those langgraph methods.
I doubt Langchain has code in those lower API graphs that offer methods to create those graphs with compile options to enable Store class and other classes that use long term memory ie hitting their Postgres backend on langsmith deploy(langgraph platform)