mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-17 21:25:46 +02:00
52bbd34673
Bumps the all-dependencies group in /libs/checkpoint-postgres with 2 updates: [orjson](https://github.com/ijl/orjson) and [ruff](https://github.com/astral-sh/ruff). Updates `orjson` from 3.11.5 to 3.11.7 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/ijl/orjson/releases">orjson's releases</a>.</em></p> <blockquote> <h2>3.11.7</h2> <h3>Changed</h3> <ul> <li>Use a faster library to serialize <code>float</code>. Users with byte-exact regression tests should note positive exponents are now written using a <code>+</code>, e.g., <code>1.2e+30</code> instead of <code>1.2e30</code>. Both formats are spec-compliant.</li> <li>ABI compatibility with CPython 3.15 alpha 5 free-threading.</li> </ul> <h2>3.11.6</h2> <h3>Changed</h3> <ul> <li>orjson now includes code licensed under the Mozilla Public License 2.0 (MPL-2.0).</li> <li>Drop support for Python 3.9.</li> <li>ABI compatibility with CPython 3.15 alpha 5.</li> <li>Build now depends on Rust 1.89 or later instead of 1.85.</li> </ul> <h3>Fixed</h3> <ul> <li>Fix sporadic crash serializing deeply nested <code>list</code> of <code>dict</code>.</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/ijl/orjson/blob/master/CHANGELOG.md">orjson's changelog</a>.</em></p> <blockquote> <h2>3.11.7 - 2026-02-02</h2> <h3>Changed</h3> <ul> <li>Use a faster library to serialize <code>float</code>. Users with byte-exact regression tests should note positive exponents are now written using a <code>+</code>, e.g., <code>1.2e+30</code> instead of <code>1.2e30</code>. Both formats are spec-compliant.</li> <li>ABI compatibility with CPython 3.15 alpha 5 free-threading.</li> </ul> <h2>3.11.6 - 2026-01-29</h2> <h3>Changed</h3> <ul> <li>orjson now includes code licensed under the Mozilla Public License 2.0 (MPL-2.0).</li> <li>Drop support for Python 3.9.</li> <li>ABI compatibility with CPython 3.15 alpha 5.</li> <li>Build now depends on Rust 1.89 or later instead of 1.85.</li> </ul> <h3>Fixed</h3> <ul> <li>Fix sporadic crash serializing deeply nested <code>list</code> of <code>dict</code>.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/ijl/orjson/commit/ec2b066cae79ae4a90ed126ac5723335dd99e408"><code>ec2b066</code></a> 3.11.7</li> <li><a href="https://github.com/ijl/orjson/commit/1ca01f78cf4198ec37407d83713afa6e5c53dbf9"><code>1ca01f7</code></a> zmij</li> <li><a href="https://github.com/ijl/orjson/commit/1716a226bd1f38db01503f30cd37b0efec48d88e"><code>1716a22</code></a> cargo update</li> <li><a href="https://github.com/ijl/orjson/commit/ec02024c3837255064f248c0d2d331319b75e9ad"><code>ec02024</code></a> 3.11.6</li> <li><a href="https://github.com/ijl/orjson/commit/d58168733189f82b3fd0c058dff73e05d09202e6"><code>d581687</code></a> build, clippy misc</li> <li><a href="https://github.com/ijl/orjson/commit/4105b29b2275f200f6fae01349bef02ccf1bc2e2"><code>4105b29</code></a> writer::num</li> <li><a href="https://github.com/ijl/orjson/commit/62bb185b70785ded49c79c26f8c9781f1e6fe370"><code>62bb185</code></a> Fix sporadic crash on serializing object close</li> <li><a href="https://github.com/ijl/orjson/commit/d860078a973f44401265c5c4ad12a7dbe4f839ad"><code>d860078</code></a> PyRef idiom refactors</li> <li><a href="https://github.com/ijl/orjson/commit/343ae2f148197918aba9f8562db42c364620e4b8"><code>343ae2f</code></a> Deserializer, Utf8Buffer</li> <li><a href="https://github.com/ijl/orjson/commit/7835f58d1c56947d1cf7a18acdfc07a2bca9b0f2"><code>7835f58</code></a> PyBytesRef and other input refactor</li> <li>Additional commits viewable in <a href="https://github.com/ijl/orjson/compare/3.11.5...3.11.7">compare view</a></li> </ul> </details> <br /> Updates `ruff` from 0.14.13 to 0.15.1 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/ruff/releases">ruff's releases</a>.</em></p> <blockquote> <h2>0.15.1</h2> <h2>Release Notes</h2> <p>Released on 2026-02-12.</p> <h3>Preview features</h3> <ul> <li>[<code>airflow</code>] Add ruff rules to catch deprecated Airflow imports for Airflow 3.1 (<code>AIR321</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22376">#22376</a>)</li> <li>[<code>airflow</code>] Third positional parameter not named <code>ti_key</code> should be flagged for <code>BaseOperatorLink.get_link</code> (<code>AIR303</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22828">#22828</a>)</li> <li>[<code>flake8-gettext</code>] Fix false negatives for plural argument of <code>ngettext</code> (<code>INT001</code>, <code>INT002</code>, <code>INT003</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/21078">#21078</a>)</li> <li>[<code>pyflakes</code>] Fix infinite loop in preview fix for <code>unused-import</code> (<code>F401</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23038">#23038</a>)</li> <li>[<code>pygrep-hooks</code>] Detect non-existent mock methods in standalone expressions (<code>PGH005</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22830">#22830</a>)</li> <li>[<code>pylint</code>] Allow dunder submodules and improve diagnostic range (<code>PLC2701</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22804">#22804</a>)</li> <li>[<code>pyupgrade</code>] Improve diagnostic range for tuples (<code>UP024</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23013">#23013</a>)</li> <li>[<code>refurb</code>] Check subscripts in tuple do not use lambda parameters in <code>reimplemented-operator</code> (<code>FURB118</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23079">#23079</a>)</li> <li>[<code>ruff</code>] Detect mutable defaults in <code>field</code> calls (<code>RUF008</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23046">#23046</a>)</li> <li>[<code>ruff</code>] Ignore std <code>cmath.inf</code> (<code>RUF069</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23120">#23120</a>)</li> <li>[<code>ruff</code>] New rule <code>float-equality-comparison</code> (<code>RUF069</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/20585">#20585</a>)</li> <li>Don't format unlabeled Markdown code blocks (<a href="https://redirect.github.com/astral-sh/ruff/pull/23106">#23106</a>)</li> <li>Markdown formatting support in LSP (<a href="https://redirect.github.com/astral-sh/ruff/pull/23063">#23063</a>)</li> <li>Support Quarto Markdown language markers (<a href="https://redirect.github.com/astral-sh/ruff/pull/22947">#22947</a>)</li> <li>Support formatting <code>pycon</code> Markdown code blocks (<a href="https://redirect.github.com/astral-sh/ruff/pull/23112">#23112</a>)</li> <li>Use extension mapping to select Markdown code block language (<a href="https://redirect.github.com/astral-sh/ruff/pull/22934">#22934</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Avoid false positive for undefined variables in <code>FAST001</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23224">#23224</a>)</li> <li>Avoid introducing syntax errors for <code>FAST003</code> autofix (<a href="https://redirect.github.com/astral-sh/ruff/pull/23227">#23227</a>)</li> <li>Avoid suggesting <code>InitVar</code> for <code>__post_init__</code> that references PEP 695 type parameters (<a href="https://redirect.github.com/astral-sh/ruff/pull/23226">#23226</a>)</li> <li>Deduplicate type variables in generic functions (<a href="https://redirect.github.com/astral-sh/ruff/pull/23225">#23225</a>)</li> <li>Fix exception handler parenthesis removal for Python 3.14+ (<a href="https://redirect.github.com/astral-sh/ruff/pull/23126">#23126</a>)</li> <li>Fix f-string middle panic when parsing t-strings (<a href="https://redirect.github.com/astral-sh/ruff/pull/23232">#23232</a>)</li> <li>Wrap <code>RUF020</code> target for multiline fixes (<a href="https://redirect.github.com/astral-sh/ruff/pull/23210">#23210</a>)</li> <li>Wrap <code>UP007</code> target for multiline fixes (<a href="https://redirect.github.com/astral-sh/ruff/pull/23208">#23208</a>)</li> <li>Fix missing diagnostics for last range suppression in file (<a href="https://redirect.github.com/astral-sh/ruff/pull/23242">#23242</a>)</li> <li>[<code>pyupgrade</code>] Fix syntax error on string with newline escape and comment (<code>UP037</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22968">#22968</a>)</li> </ul> <h3>Rule changes</h3> <ul> <li>Use <code>ruff</code> instead of <code>Ruff</code> as the program name in GitHub output format (<a href="https://redirect.github.com/astral-sh/ruff/pull/23240">#23240</a>)</li> <li>[<code>PT006</code>] Fix syntax error when unpacking nested tuples in <code>parametrize</code> fixes (<a href="https://redirect.github.com/astral-sh/ruff/issues/22441">#22441</a>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22464">#22464</a>)</li> <li>[<code>airflow</code>] Catch deprecated attribute access from context key for Airflow 3.0 (<code>AIR301</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22850">#22850</a>)</li> <li>[<code>airflow</code>] Capture deprecated arguments and a decorator (<code>AIR301</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23170">#23170</a>)</li> <li>[<code>flake8-boolean-trap</code>] Add <code>multiprocessing.Value</code> to excluded functions for <code>FBT003</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23010">#23010</a>)</li> <li>[<code>flake8-bugbear</code>] Add a secondary annotation showing the previous occurrence (<code>B033</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22634">#22634</a>)</li> <li>[<code>flake8-type-checking</code>] Add sub-diagnostic showing the runtime use of an annotation (<code>TC004</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23091">#23091</a>)</li> <li>[<code>isort</code>] Support configurable import section heading comments (<a href="https://redirect.github.com/astral-sh/ruff/pull/23151">#23151</a>)</li> <li>[<code>ruff</code>] Improve the diagnostic for <code>RUF012</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23202">#23202</a>)</li> </ul> <h3>Formatter</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md">ruff's changelog</a>.</em></p> <blockquote> <h2>0.15.1</h2> <p>Released on 2026-02-12.</p> <h3>Preview features</h3> <ul> <li>[<code>airflow</code>] Add ruff rules to catch deprecated Airflow imports for Airflow 3.1 (<code>AIR321</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22376">#22376</a>)</li> <li>[<code>airflow</code>] Third positional parameter not named <code>ti_key</code> should be flagged for <code>BaseOperatorLink.get_link</code> (<code>AIR303</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22828">#22828</a>)</li> <li>[<code>flake8-gettext</code>] Fix false negatives for plural argument of <code>ngettext</code> (<code>INT001</code>, <code>INT002</code>, <code>INT003</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/21078">#21078</a>)</li> <li>[<code>pyflakes</code>] Fix infinite loop in preview fix for <code>unused-import</code> (<code>F401</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23038">#23038</a>)</li> <li>[<code>pygrep-hooks</code>] Detect non-existent mock methods in standalone expressions (<code>PGH005</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22830">#22830</a>)</li> <li>[<code>pylint</code>] Allow dunder submodules and improve diagnostic range (<code>PLC2701</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22804">#22804</a>)</li> <li>[<code>pyupgrade</code>] Improve diagnostic range for tuples (<code>UP024</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23013">#23013</a>)</li> <li>[<code>refurb</code>] Check subscripts in tuple do not use lambda parameters in <code>reimplemented-operator</code> (<code>FURB118</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23079">#23079</a>)</li> <li>[<code>ruff</code>] Detect mutable defaults in <code>field</code> calls (<code>RUF008</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23046">#23046</a>)</li> <li>[<code>ruff</code>] Ignore std <code>cmath.inf</code> (<code>RUF069</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23120">#23120</a>)</li> <li>[<code>ruff</code>] New rule <code>float-equality-comparison</code> (<code>RUF069</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/20585">#20585</a>)</li> <li>Don't format unlabeled Markdown code blocks (<a href="https://redirect.github.com/astral-sh/ruff/pull/23106">#23106</a>)</li> <li>Markdown formatting support in LSP (<a href="https://redirect.github.com/astral-sh/ruff/pull/23063">#23063</a>)</li> <li>Support Quarto Markdown language markers (<a href="https://redirect.github.com/astral-sh/ruff/pull/22947">#22947</a>)</li> <li>Support formatting <code>pycon</code> Markdown code blocks (<a href="https://redirect.github.com/astral-sh/ruff/pull/23112">#23112</a>)</li> <li>Use extension mapping to select Markdown code block language (<a href="https://redirect.github.com/astral-sh/ruff/pull/22934">#22934</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Avoid false positive for undefined variables in <code>FAST001</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23224">#23224</a>)</li> <li>Avoid introducing syntax errors for <code>FAST003</code> autofix (<a href="https://redirect.github.com/astral-sh/ruff/pull/23227">#23227</a>)</li> <li>Avoid suggesting <code>InitVar</code> for <code>__post_init__</code> that references PEP 695 type parameters (<a href="https://redirect.github.com/astral-sh/ruff/pull/23226">#23226</a>)</li> <li>Deduplicate type variables in generic functions (<a href="https://redirect.github.com/astral-sh/ruff/pull/23225">#23225</a>)</li> <li>Fix exception handler parenthesis removal for Python 3.14+ (<a href="https://redirect.github.com/astral-sh/ruff/pull/23126">#23126</a>)</li> <li>Fix f-string middle panic when parsing t-strings (<a href="https://redirect.github.com/astral-sh/ruff/pull/23232">#23232</a>)</li> <li>Wrap <code>RUF020</code> target for multiline fixes (<a href="https://redirect.github.com/astral-sh/ruff/pull/23210">#23210</a>)</li> <li>Wrap <code>UP007</code> target for multiline fixes (<a href="https://redirect.github.com/astral-sh/ruff/pull/23208">#23208</a>)</li> <li>Fix missing diagnostics for last range suppression in file (<a href="https://redirect.github.com/astral-sh/ruff/pull/23242">#23242</a>)</li> <li>[<code>pyupgrade</code>] Fix syntax error on string with newline escape and comment (<code>UP037</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22968">#22968</a>)</li> </ul> <h3>Rule changes</h3> <ul> <li>Use <code>ruff</code> instead of <code>Ruff</code> as the program name in GitHub output format (<a href="https://redirect.github.com/astral-sh/ruff/pull/23240">#23240</a>)</li> <li>[<code>PT006</code>] Fix syntax error when unpacking nested tuples in <code>parametrize</code> fixes (<a href="https://redirect.github.com/astral-sh/ruff/issues/22441">#22441</a>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22464">#22464</a>)</li> <li>[<code>airflow</code>] Catch deprecated attribute access from context key for Airflow 3.0 (<code>AIR301</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22850">#22850</a>)</li> <li>[<code>airflow</code>] Capture deprecated arguments and a decorator (<code>AIR301</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23170">#23170</a>)</li> <li>[<code>flake8-boolean-trap</code>] Add <code>multiprocessing.Value</code> to excluded functions for <code>FBT003</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23010">#23010</a>)</li> <li>[<code>flake8-bugbear</code>] Add a secondary annotation showing the previous occurrence (<code>B033</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/22634">#22634</a>)</li> <li>[<code>flake8-type-checking</code>] Add sub-diagnostic showing the runtime use of an annotation (<code>TC004</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/23091">#23091</a>)</li> <li>[<code>isort</code>] Support configurable import section heading comments (<a href="https://redirect.github.com/astral-sh/ruff/pull/23151">#23151</a>)</li> <li>[<code>ruff</code>] Improve the diagnostic for <code>RUF012</code> (<a href="https://redirect.github.com/astral-sh/ruff/pull/23202">#23202</a>)</li> </ul> <h3>Formatter</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/astral-sh/ruff/commit/a2f11d239f91cf8daedb0764ec15fcfe29c5ae6d"><code>a2f11d2</code></a> Prepare for 0.15.1 (<a href="https://redirect.github.com/astral-sh/ruff/issues/23253">#23253</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/d29628e9665baa17272aad489398eb72b70e60ff"><code>d29628e</code></a> Remove docker-run-action (<a href="https://redirect.github.com/astral-sh/ruff/issues/23254">#23254</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/8a042667651d7b1cdfc1742478d2b29b04d91be0"><code>8a04266</code></a> [ty] Allow discovering dependencies in system Python environments (<a href="https://redirect.github.com/astral-sh/ruff/issues/22994">#22994</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/55d06c8879761c5500e9558502abc84cefcb7163"><code>55d06c8</code></a> Ensure pending suppression diagnostics are reported (<a href="https://redirect.github.com/astral-sh/ruff/issues/23242">#23242</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/d056a9fa6dfb842f2c0d439bf7b1a8099e5734ea"><code>d056a9f</code></a> [<code>isort</code>] support for configurable import section heading comments (<a href="https://redirect.github.com/astral-sh/ruff/issues/23151">#23151</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/e22fa4f14d8fae550249e452d11bc53756df5c7a"><code>e22fa4f</code></a> [ty] Fix method calls on subclasses of <code>Any</code> (<a href="https://redirect.github.com/astral-sh/ruff/issues/23248">#23248</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/fa56c1550d723e458b91dc2405d5537d40401d5c"><code>fa56c15</code></a> [ty] Fix bound method access on <code>None</code> (<a href="https://redirect.github.com/astral-sh/ruff/issues/23246">#23246</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/4fd07d0e1cbbb4e4c3f5b4c1f04f2d8b3f4a2bf2"><code>4fd07d0</code></a> Make range suppression test snapshot actually useful (<a href="https://redirect.github.com/astral-sh/ruff/issues/23251">#23251</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/8c63bced13b21d1952a56e6a096d9c2ec4af442f"><code>8c63bce</code></a> [ty] Include conditional symbols (like <code>datetime.UTC</code>) in auto-import in more...</li> <li><a href="https://github.com/astral-sh/ruff/commit/46be94361b3b4c54be911eb88bfbd9666eb06a6d"><code>46be943</code></a> Exclude WASM artifacts from GitHub releases (<a href="https://redirect.github.com/astral-sh/ruff/issues/23221">#23221</a>)</li> <li>Additional commits viewable in <a href="https://github.com/astral-sh/ruff/compare/0.14.13...0.15.1">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
LangGraph Checkpoint Postgres
Implementation of LangGraph CheckpointSaver that uses Postgres.
Dependencies
By default langgraph-checkpoint-postgres installs psycopg (Psycopg 3) without any extras. However, you can choose a specific installation that best suits your needs here (for example, psycopg[binary]).
Usage
Important
When using Postgres checkpointers for the first time, make sure to call
.setup()method on them to create required tables. See example below.
Important
When manually creating Postgres connections and passing them to
PostgresSaverorAsyncPostgresSaver, make sure to includeautocommit=Trueandrow_factory=dict_row(from psycopg.rows import dict_row). See a full example in this how-to guide.Why these parameters are required:
autocommit=True: Required for the.setup()method to properly commit the checkpoint tables to the database. Without this, table creation may not be persisted.row_factory=dict_row: Required because the PostgresSaver implementation accesses database rows using dictionary-style syntax (e.g.,row["column_name"]). The defaulttuple_rowfactory returns tuples that only support index-based access (e.g.,row[0]), which will causeTypeErrorexceptions when the checkpointer tries to access columns by name.Example of incorrect usage:
# ❌ This will fail with TypeError during checkpointer operations with psycopg.connect(DB_URI) as conn: # Missing autocommit=True and row_factory=dict_row checkpointer = PostgresSaver(conn) checkpointer.setup() # May not persist tables properly # Any operation that reads from database will fail with: # TypeError: tuple indices must be integers or slices, not str
from langgraph.checkpoint.postgres import PostgresSaver
write_config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}}
read_config = {"configurable": {"thread_id": "1"}}
DB_URI = "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable"
with PostgresSaver.from_conn_string(DB_URI) as checkpointer:
# call .setup() the first time you're using the checkpointer
checkpointer.setup()
checkpoint = {
"v": 4,
"ts": "2024-07-31T20:14:19.804150+00:00",
"id": "1ef4f797-8335-6428-8001-8a1503f9b875",
"channel_values": {
"my_key": "meow",
"node": "node"
},
"channel_versions": {
"__start__": 2,
"my_key": 3,
"start:node": 3,
"node": 3
},
"versions_seen": {
"__input__": {},
"__start__": {
"__start__": 1
},
"node": {
"start:node": 2
}
},
}
# store checkpoint
checkpointer.put(write_config, checkpoint, {}, {})
# load checkpoint
checkpointer.get(read_config)
# list checkpoints
list(checkpointer.list(read_config))
Async
from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
async with AsyncPostgresSaver.from_conn_string(DB_URI) as checkpointer:
checkpoint = {
"v": 4,
"ts": "2024-07-31T20:14:19.804150+00:00",
"id": "1ef4f797-8335-6428-8001-8a1503f9b875",
"channel_values": {
"my_key": "meow",
"node": "node"
},
"channel_versions": {
"__start__": 2,
"my_key": 3,
"start:node": 3,
"node": 3
},
"versions_seen": {
"__input__": {},
"__start__": {
"__start__": 1
},
"node": {
"start:node": 2
}
},
}
# store checkpoint
await checkpointer.aput(write_config, checkpoint, {}, {})
# load checkpoint
await checkpointer.aget(read_config)
# list checkpoints
[c async for c in checkpointer.alist(read_config)]