run_id and other config parameters are not persisted when calling an agent
Checked other resources
- [x] This is a bug, not a usage question. For questions, 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
compiled_graph = graph.compile(checkpointer=AsyncPostgresSaver(...))
stream_agent = compiled_graph.astream(
{"messages": [query]},
config={
"callbacks": [CallbackHandler(user_id=user_id, session_id=thread_id)],
"configurable": {"thread_id": thread_id},
"run_id": run_id,
"run_name": "chat_agent"}
},
stream_mode="messages",
)
Error Message and Stack Trace (if applicable)
Description
I noticed that only thread_id and checkpoint_id are being persisted. However, I would also expect run_id (and potentially other config parameters) to be saved, as it’s critical for features like attaching user feedback to a specific run later on.
Feature Request: Please consider persisting additional config values such as run_id in the database or checkpoint. This would make it easier to track and interact with specific runs across sessions or when implementing post-run features like feedback collection.
System Info
System Information
OS: Darwin OS Version: Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:32 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6030 Python Version: 3.11.11 (main, Dec 3 2024, 17:20:40) [Clang 16.0.0 (clang-1600.0.26.4)]
Package Information
langchain_core: 0.3.51 langchain: 0.3.23 langchain_community: 0.3.21 langsmith: 0.3.27 langchain_aws: 0.2.15 langchain_google_vertexai: 2.0.15 langchain_openai: 0.3.12 langchain_text_splitters: 0.3.8 langchain_weaviate: 0.0.4 langgraph_sdk: 0.1.61
Optional packages not installed
langserve
Other Dependencies
aiohttp<4.0.0,>=3.8.3: Installed. No version info available. anthropic[vertexai]: Installed. No version info available. async-timeout<5.0.0,>=4.0.0;: Installed. No version info available. boto3: 1.37.0 dataclasses-json<0.7,>=0.5.7: Installed. No version info available. google-cloud-aiplatform: 1.83.0 google-cloud-storage: 2.19.0 httpx: 0.28.1 httpx-sse: 0.4.0 httpx-sse<1.0.0,>=0.4.0: Installed. No version info available. jsonpatch<2.0,>=1.33: Installed. No version info available. langchain-anthropic;: Installed. No version info available. langchain-aws;: Installed. No version info available. langchain-azure-ai;: Installed. No version info available. langchain-cohere;: Installed. No version info available. langchain-community;: Installed. No version info available. langchain-core<1.0.0,>=0.3.49: Installed. No version info available. langchain-core<1.0.0,>=0.3.51: Installed. No version info available. langchain-deepseek;: Installed. No version info available. langchain-fireworks;: Installed. No version info available. langchain-google-genai;: Installed. No version info available. langchain-google-vertexai;: Installed. No version info available. langchain-groq;: Installed. No version info available. langchain-huggingface;: Installed. No version info available. langchain-mistralai: Installed. No version info available. langchain-mistralai;: Installed. No version info available. langchain-ollama;: Installed. No version info available. langchain-openai;: Installed. No version info available. langchain-perplexity;: Installed. No version info available. langchain-text-splitters<1.0.0,>=0.3.8: Installed. No version info available. langchain-together;: Installed. No version info available. langchain-xai;: Installed. No version info available. langchain<1.0.0,>=0.3.23: Installed. No version info available. langsmith-pyo3: Installed. No version info available. langsmith<0.4,>=0.1.125: Installed. No version info available. langsmith<0.4,>=0.1.17: Installed. No version info available. numpy: 1.26.4 numpy<3,>=1.26.2: Installed. No version info available. openai-agents: Installed. No version info available. openai<2.0.0,>=1.68.2: Installed. No version info available. opentelemetry-api: Installed. No version info available. opentelemetry-exporter-otlp-proto-http: Installed. No version info available. opentelemetry-sdk: Installed. No version info available. orjson: 3.10.16 packaging: 24.2 packaging<25,>=23.2: Installed. No version info available. pydantic: 2.10.6 pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available. pydantic<3.0.0,>=2.5.2;: Installed. No version info available. pydantic<3.0.0,>=2.7.4: Installed. No version info available. pydantic<3.0.0,>=2.7.4;: Installed. No version info available. pytest: 8.3.5 PyYAML>=5.3: Installed. No version info available. requests: 2.32.3 requests-toolbelt: 1.0.0 requests<3,>=2: Installed. No version info available. rich: Installed. No version info available. simsimd: 6.2.1 SQLAlchemy<3,>=1.4: Installed. No version info available. tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available. tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. tiktoken<1,>=0.7: Installed. No version info available. typing-extensions>=4.7: Installed. No version info available. weaviate-client: 4.12.1 zstandard: 0.23.0
Run ID is unique to a given run / execution, so re-using it later is invalid - would your use case work if you put it in configurable?
Run ID is unique to a given run / execution, so re-using it later is invalid
I dont want to reuse it, I just want to reference it later to track a given run in langfuse for example.
would your use case work if you put it in configurable?
No because its not persisted there. Only the thread_id, checkpoint_id, checkpoint_ns, and the config metadata are persisted. Refer to: https://github.com/langchain-ai/langgraph/blob/8c4904bee93cc4124f11132c7c3f4e747dbce3c0/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py#L272-L280
I think it probably makes sense to put this in metadata for tracing. Closing as resolved for now!
How can I access this metadata and inject the run_id there? I think this is handled by the async posgressaver under the hood