langgraph_checkpoint_firestore 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/PKG-INFO +2 -2
  2. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/pyproject.toml +3 -3
  3. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/uv.lock +6 -6
  4. langgraph_checkpoint_firestore-0.2.0/README.md +0 -167
  5. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/.gitignore +0 -0
  6. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/CHANGELOG.md +0 -0
  7. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/readme.md +0 -0
  8. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/requirement.txt +0 -0
  9. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/src/langgraph_checkpoint_firestore/LICENSE +0 -0
  10. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/src/langgraph_checkpoint_firestore/__init__.py +0 -0
  11. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/src/langgraph_checkpoint_firestore/firestoreSaver.py +0 -0
  12. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/src/langgraph_checkpoint_firestore/firestoreSerializer.py +0 -0
  13. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/tests/interrupt.py +0 -0
  14. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/tests/subgraph.py +0 -0
  15. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/tests/test.py +0 -0
  16. {langgraph_checkpoint_firestore-0.2.0 → langgraph_checkpoint_firestore-0.2.2}/tests/test_reducer_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph_checkpoint_firestore
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: LangGraph checkpoint saver for Google Firestore with built-in message history pruning via agentstate-reducer
5
5
  Author-email: Kamal <skamalj@github.com>
6
6
  Keywords: agent-state,checkpoint,firestore,google-cloud,langchain,langgraph,memory,message-reducer
@@ -19,7 +19,7 @@ Requires-Dist: mypy; extra == 'dev'
19
19
  Requires-Dist: pytest-cov; extra == 'dev'
20
20
  Requires-Dist: pytest>=7.0; extra == 'dev'
21
21
  Provides-Extra: reducer
22
- Requires-Dist: agentstate-reducer>=0.1.1; extra == 'reducer'
22
+ Requires-Dist: agentstate-reducer>=0.3.0; extra == 'reducer'
23
23
  Description-Content-Type: text/markdown
24
24
 
25
25
  # langgraph-checkpoint-firestore
@@ -4,10 +4,10 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "langgraph_checkpoint_firestore"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "LangGraph checkpoint saver for Google Firestore with built-in message history pruning via agentstate-reducer"
9
9
  authors = [{name = "Kamal", email = "skamalj@github.com"}]
10
- readme = "README.md"
10
+ readme = "readme.md"
11
11
  requires-python = ">=3.10"
12
12
  dependencies = [
13
13
  "langchain-core",
@@ -27,7 +27,7 @@ classifiers = [
27
27
 
28
28
  [project.optional-dependencies]
29
29
  reducer = [
30
- "agentstate-reducer>=0.1.1",
30
+ "agentstate-reducer>=0.3.0",
31
31
  ]
32
32
  dev = [
33
33
  "pytest>=7.0",
@@ -11,11 +11,11 @@ resolution-markers = [
11
11
 
12
12
  [[package]]
13
13
  name = "agentstate-reducer"
14
- version = "0.1.1"
14
+ version = "0.3.0"
15
15
  source = { registry = "https://pypi.org/simple" }
16
- sdist = { url = "https://files.pythonhosted.org/packages/13/2e/783d9c08b2b9586921d4478ad3cf8e5dc30c2300b0ccab524a23f4cbd819/agentstate_reducer-0.1.1.tar.gz", hash = "sha256:9b19729a0626b3220de1e5189dbb6e88b8f78a059347acdde17bcc3d7c9e7229", size = 10862, upload-time = "2026-06-26T12:05:01.121Z" }
16
+ sdist = { url = "https://files.pythonhosted.org/packages/66/2f/8ae3e2a6e39e8b11879fd0a8c139107bd114388d2ad8d6cf723e29b05ded/agentstate_reducer-0.3.0.tar.gz", hash = "sha256:9f760f595b206ed69c8104d8b771613c2937ee90bd4b842fe2bc32a72e90e000", size = 34742, upload-time = "2026-07-26T07:10:49.387Z" }
17
17
  wheels = [
18
- { url = "https://files.pythonhosted.org/packages/b8/76/e5aa1b033799f8be438e1913965a0006c638c01947923fb8561f1850efe6/agentstate_reducer-0.1.1-py3-none-any.whl", hash = "sha256:fd9a05e29fcf69a1291d1efe1826b702f8e02742121d179867327b1eabc15b5e", size = 8761, upload-time = "2026-06-26T12:05:02.127Z" },
18
+ { url = "https://files.pythonhosted.org/packages/f4/3a/f02127dce0708754bcdc1446cf3f4c875d129b2b8677c8eebf03b12415a0/agentstate_reducer-0.3.0-py3-none-any.whl", hash = "sha256:79d2174fe9e737f4cede6285b3a786c4fc2e7140481c9222ce7a97f220764684", size = 14703, upload-time = "2026-07-26T07:10:47.928Z" },
19
19
  ]
20
20
 
21
21
  [[package]]
@@ -516,7 +516,7 @@ name = "exceptiongroup"
516
516
  version = "1.3.1"
517
517
  source = { registry = "https://pypi.org/simple" }
518
518
  dependencies = [
519
- { name = "typing-extensions", marker = "python_full_version < '3.13'" },
519
+ { name = "typing-extensions", marker = "python_full_version < '3.11'" },
520
520
  ]
521
521
  sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" }
522
522
  wheels = [
@@ -937,7 +937,7 @@ wheels = [
937
937
 
938
938
  [[package]]
939
939
  name = "langgraph-checkpoint-firestore"
940
- version = "0.2.0"
940
+ version = "0.2.2"
941
941
  source = { editable = "." }
942
942
  dependencies = [
943
943
  { name = "google-cloud-firestore" },
@@ -967,7 +967,7 @@ dev = [
967
967
 
968
968
  [package.metadata]
969
969
  requires-dist = [
970
- { name = "agentstate-reducer", marker = "extra == 'reducer'", specifier = ">=0.1.1" },
970
+ { name = "agentstate-reducer", marker = "extra == 'reducer'", specifier = ">=0.3.0" },
971
971
  { name = "black", marker = "extra == 'dev'" },
972
972
  { name = "google-cloud-firestore" },
973
973
  { name = "isort", marker = "extra == 'dev'" },
@@ -1,167 +0,0 @@
1
- # langgraph-checkpoint-firestore
2
-
3
- Google Firestore checkpoint saver for [LangGraph](https://github.com/langchain-ai/langgraph). Persists agent state between runs so your graphs can resume from any prior checkpoint.
4
-
5
- **What makes this checkpointer different:** it has message history pruning built in. Pass a `MessageReducer` and the checkpointer automatically caps your message list before writing to Firestore — no extra code in your graph, no state annotation changes required. This is the only LangGraph Firestore checkpointer with this capability.
6
-
7
- ## Features
8
-
9
- - **Full checkpoint persistence** — save, retrieve, and list LangGraph checkpoints in Google Firestore
10
- - **Built-in message pruning** — optional `MessageReducer` prunes message history at the persistence layer, keeping checkpoints lean without changing your graph code
11
- - **Sync and async API** — `put`/`get_tuple`/`list` and their `aput`/`aget_tuple`/`alist` async counterparts
12
- - **Subgraph support** — correctly checkpoints parent and subgraph state independently
13
- - **Native Firestore hierarchy** — checkpoints stored in subcollections per thread, enabling efficient per-thread queries
14
-
15
- ## Installation
16
-
17
- ```bash
18
- pip install langgraph-checkpoint-firestore
19
- ```
20
-
21
- With optional message pruning support:
22
-
23
- ```bash
24
- pip install "langgraph-checkpoint-firestore[reducer]"
25
- ```
26
-
27
- **Requires Python 3.10+**
28
-
29
- ## Firestore Setup
30
-
31
- The saver uses Google Cloud Application Default Credentials. Set up auth with one of:
32
-
33
- ```bash
34
- # Local development — authenticate with your Google account
35
- gcloud auth application-default login
36
-
37
- # Service account (CI / production)
38
- export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
39
- ```
40
-
41
- Your Firestore instance must be in **Native mode** (not Datastore mode). Collections are created automatically on first write — no manual setup required.
42
-
43
- ## Quick Start
44
-
45
- ```python
46
- from langgraph.graph import StateGraph, MessagesState, START
47
- from langchain_openai import ChatOpenAI
48
- from langgraph_checkpoint_firestore import FirestoreSaver
49
-
50
- model = ChatOpenAI(model="gpt-4o-mini")
51
-
52
- def call_model(state: MessagesState):
53
- return {"messages": model.invoke(state["messages"])}
54
-
55
- builder = StateGraph(MessagesState)
56
- builder.add_node("call_model", call_model)
57
- builder.add_edge(START, "call_model")
58
-
59
- with FirestoreSaver.from_conn_info(project_id="my-gcp-project", checkpoints_collection="checkpoints") as checkpointer:
60
- graph = builder.compile(checkpointer=checkpointer)
61
-
62
- config = {"configurable": {"thread_id": "user-123"}}
63
-
64
- # First run — state is saved to Firestore
65
- graph.invoke({"messages": [{"role": "user", "content": "Hi, I'm Kamal"}]}, config)
66
-
67
- # Second run — picks up where it left off
68
- graph.invoke({"messages": [{"role": "user", "content": "What's my name?"}]}, config)
69
- ```
70
-
71
- ## API Reference
72
-
73
- ### `FirestoreSaver(project_id, checkpoints_collection, reducer=None, messages_key="messages")`
74
-
75
- | Parameter | Type | Default | Description |
76
- |---|---|---|---|
77
- | `project_id` | `str` | required | Google Cloud project ID |
78
- | `checkpoints_collection` | `str` | `"checkpoints"` | Root Firestore collection name |
79
- | `reducer` | `MessageReducer` | `None` | Optional pruner — see [Message Pruning](#built-in-message-pruning) |
80
- | `messages_key` | `str` | `"messages"` | State channel name that holds the message list |
81
-
82
- You can also use the context manager factory:
83
-
84
- ```python
85
- with FirestoreSaver.from_conn_info(
86
- project_id="my-gcp-project",
87
- checkpoints_collection="checkpoints",
88
- reducer=reducer,
89
- messages_key="messages"
90
- ) as saver:
91
- graph = builder.compile(checkpointer=saver)
92
- ```
93
-
94
- ### Sync methods
95
-
96
- | Method | Description |
97
- |---|---|
98
- | `put(config, checkpoint, metadata, new_versions)` | Save a checkpoint |
99
- | `put_writes(config, writes, task_id)` | Save pending writes for a checkpoint |
100
- | `get_tuple(config)` | Retrieve the latest (or a specific) checkpoint |
101
- | `list(config, *, before, limit)` | Iterate checkpoints for a thread |
102
-
103
- ### Async methods
104
-
105
- All sync methods have async counterparts: `aput`, `aput_writes`, `aget_tuple`, `alist`.
106
-
107
- ## Built-in Message Pruning
108
-
109
- Long-running agents accumulate message history with every turn. Left unchecked this inflates checkpoint size, increases Firestore storage costs, and eventually blows past LLM context limits.
110
-
111
- This checkpointer solves that at the persistence layer: pass a `MessageReducer` and it automatically prunes the message list inside `put()` before the checkpoint is serialised and written to Firestore. **Your graph code, state definition, and node logic stay untouched.**
112
-
113
- This is an alternative to — or complement of — the LangGraph `Annotated[list, reducer_fn]` pattern. Use the checkpoint-layer approach when:
114
-
115
- - You don't own the graph or state definition (e.g. using a pre-built LangGraph agent)
116
- - You want pruning to happen unconditionally at every save, regardless of which node triggered it
117
- - You want to keep all in-memory state intact and only prune what gets persisted
118
-
119
- ### Install with reducer support
120
-
121
- ```bash
122
- pip install "langgraph-checkpoint-firestore[reducer]"
123
- ```
124
-
125
- ### Usage
126
-
127
- ```python
128
- from agentstate_reducer import MessageReducer
129
- from langgraph_checkpoint_firestore import FirestoreSaver
130
-
131
- reducer = MessageReducer(min_messages=10, max_messages=20)
132
-
133
- with FirestoreSaver.from_conn_info(
134
- project_id="my-gcp-project",
135
- checkpoints_collection="checkpoints",
136
- reducer=reducer, # prune before each checkpoint save
137
- messages_key="messages" # state channel holding the message list (default)
138
- ) as checkpointer:
139
- graph = builder.compile(checkpointer=checkpointer)
140
- ```
141
-
142
- When `len(messages) > max_messages`, the oldest `human`/`ai` messages are removed until `min_messages` remain. The following are **never** pruned:
143
-
144
- - Index 0 (typically the system prompt) — controlled by `preserve_first=True`
145
- - `system` and `function` messages
146
- - `tool` messages — unless their parent `ai` message is pruned (cascade behaviour, configurable)
147
-
148
- See [agentstate-reducer on PyPI](https://pypi.org/project/agentstate-reducer/) for full configuration: `preserve_first`, `cascade_tool_messages`, `summarize_fn`, and role alias support (`user`/`assistant`/`agent`).
149
-
150
- ## Data Model
151
-
152
- Checkpoints are stored in a hierarchical Firestore structure:
153
-
154
- ```
155
- {checkpoints_collection}/
156
- {thread_id}_{checkpoint_ns}/ ← partition document
157
- checkpoints/
158
- {checkpoint_id} ← checkpoint document
159
- writes/
160
- {task_id}_{idx} ← pending write documents
161
- ```
162
-
163
- This structure enables efficient per-thread checkpoint queries and keeps checkpoint data co-located with its pending writes.
164
-
165
- ## License
166
-
167
- MIT