Files
langgraph/libs/prebuilt
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>John Kennedyopen-swe[bot] <open-swe@users.noreply.github.com>
bbd6e2da0b chore(deps-dev): bump syrupy from 5.5.3 to 6.0.0 in /libs/prebuilt in the major group (#8780)
Bumps the major group in /libs/prebuilt with 1 update:
[syrupy](https://github.com/syrupy-project/syrupy).

Updates `syrupy` from 5.5.3 to 6.0.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/syrupy-project/syrupy/releases">syrupy's
releases</a>.</em></p>
<blockquote>
<h2>v6.0.0</h2>
<h1>Syrupy 6.0.0</h1>
<p><em>(2026-08-22)</em></p>
<p>Syrupy 6 focuses on better built-in serialization, clearer snapshot
workflows, and large-suite performance. Please review the
<strong>breaking changes</strong> before upgrading.</p>
<p>Most suites should not need significant snapshot updates on upgrade —
the main exception is <strong>dataclass</strong> usage (see below).
Syrupy v6 does <strong>not</strong> change the required Python version
or other package dependencies. Support for Python 3.10 will instead be
dropped in the next Syrupy major version (v7).</p>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/syrupy-project/syrupy/compare/v5.5.3...v6.0.0">https://github.com/syrupy-project/syrupy/compare/v5.5.3...v6.0.0</a></p>
<hr />
<h2>Breaking Changes</h2>
<h3>Built-in dataclass serialization (removed
<code>DataclassPlugin</code>)</h3>
<p>stdlib dataclasses are now serialized natively by the Amber
serializer. The separate <code>DataclassPlugin</code> has been
<strong>removed</strong>.</p>
<ul>
<li><strong>If you used <code>DataclassPlugin</code>:</strong> remove
imports and plugin wiring. Behavior should match what the plugin
produced; no snapshot rewrite should be needed for the dataclass shape
itself.</li>
<li><strong>If you did <em>not</em> use the plugin:</strong> dataclass
snapshots may change from a <code>repr</code>-style string to structured
Amber form (field-by-field). Re-run with <code>--snapshot-update</code>
where those assertions fail.</li>
</ul>
<p>Example of what to remove:</p>
<pre lang="python"><code># Before (v5)
from syrupy.extensions.amber.dataclasses_plugin import DataclassPlugin
<p>class MySerializer(AmberDataSerializer):
serializer_plugins = [DataclassPlugin, ...]
</code></pre></p>
<pre lang="python"><code># After (v6) — dataclasses work with the
default Amber extension
assert MyDataclass(...) == snapshot
</code></pre>
<p>Attrs and Pydantic models are unchanged and still need their
serializer plugins. See the <a
href="https://github.com/syrupy-project/syrupy/blob/main/tests/syrupy/extensions/amber/test_amber_serializer_plugins.py">serializer
plugins example</a>.</p>
<p>(<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1220">#1220</a>,
closes <a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1048">#1048</a>)</p>
<h3>JSON <code>datetime.date</code> snapshots</h3>
<p>The JSON extension now serializes <code>datetime.date</code> as
<code>YYYY-MM-DD</code> instead of a <code>repr</code> string. Existing
JSON snapshots that contain dates will need an update.</p>
<p>(<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1216">#1216</a>,
closes <a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1058">#1058</a>)</p>
<h3><code>path_value</code> nested path replacement in default (literal)
mode</h3>
<p><code>path_value(..., regex=False)</code> now correctly replaces
values at nested paths such as <code>user.token</code>. Previously, the
default-mode lookup missed escaped path keys, so nested values were left
unchanged (and could leak into committed snapshots).</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/syrupy-project/syrupy/blob/main/CHANGELOG.md">syrupy's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/syrupy-project/syrupy/releases/tag/v6.0.0">v6.0.0</a>
(2026-08-22)</h2>
<h2>What's Changed</h2>
<ul>
<li>chore(deps): bump pygments from 2.19.2 to 2.20.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1151">syrupy-project/syrupy#1151</a></li>
<li>chore(deps): update dependency hypothesis to v6.156.5 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1152">syrupy-project/syrupy#1152</a></li>
<li>chore(deps): update dependency ruff to v0.15.21 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1153">syrupy-project/syrupy#1153</a></li>
<li>chore(deps): update dependency hypothesis to v6.156.6 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1154">syrupy-project/syrupy#1154</a></li>
<li>chore(deps): update dependency coverage to v7.15.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1157">syrupy-project/syrupy#1157</a></li>
<li>chore(deps): update dependency mypy to v2.3.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1158">syrupy-project/syrupy#1158</a></li>
<li>fix: make set/dict serialization deterministic for partial-order
elements by <a
href="https://github.com/chuenchen309"><code>@​chuenchen309</code></a>
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1159">syrupy-project/syrupy#1159</a></li>
<li>docs: add chuenchen309 as a contributor for bug by <a
href="https://github.com/allcontributors"><code>@​allcontributors</code></a>[bot]
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1160">syrupy-project/syrupy#1160</a></li>
<li>chore(deps): update dependency coverage to v7.15.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1163">syrupy-project/syrupy#1163</a></li>
<li>chore(deps): update dependency ruff to v0.15.22 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1164">syrupy-project/syrupy#1164</a></li>
<li>chore(deps): update dependency hypothesis to v6.156.7 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1165">syrupy-project/syrupy#1165</a></li>
<li>chore(deps): update dependency hypothesis to v6.156.9 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1166">syrupy-project/syrupy#1166</a></li>
<li>chore(deps): update dependency hypothesis to v6.157.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1167">syrupy-project/syrupy#1167</a></li>
<li>fix(matchers): replace values at nested paths in path_value default
mode by <a
href="https://github.com/chuenchen309"><code>@​chuenchen309</code></a>
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1162">syrupy-project/syrupy#1162</a></li>
<li>fix: preserve skipped single-file snapshots by <a
href="https://github.com/KSmanis"><code>@​KSmanis</code></a> in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1161">syrupy-project/syrupy#1161</a></li>
<li>docs: add KSmanis as a contributor for bug by <a
href="https://github.com/allcontributors"><code>@​allcontributors</code></a>[bot]
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1168">syrupy-project/syrupy#1168</a></li>
<li>chore(deps): update pypa/gh-action-pypi-publish action to v1.14.1 by
<a href="https://github.com/renovate"><code>@​renovate</code></a>[bot]
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1169">syrupy-project/syrupy#1169</a></li>
<li>chore(deps): update dependency hypothesis to v6.157.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1171">syrupy-project/syrupy#1171</a></li>
<li>chore(deps): update actions/checkout action to v7.0.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1170">syrupy-project/syrupy#1170</a></li>
<li>chore(deps): update dependency hypothesis to v6.158.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1172">syrupy-project/syrupy#1172</a></li>
<li>chore(deps): update astral-sh/setup-uv action to v9 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1174">syrupy-project/syrupy#1174</a></li>
<li>chore(deps): update dependency hypothesis to v6.158.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1173">syrupy-project/syrupy#1173</a></li>
<li>chore(deps): update dependency hypothesis to v6.160.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1176">syrupy-project/syrupy#1176</a></li>
<li>feat: support in-memory snapshot diff data by <a
href="https://github.com/yangfan-yf-yf"><code>@​yangfan-yf-yf</code></a>
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1175">syrupy-project/syrupy#1175</a></li>
<li>docs: add yangfan-yf-yf as a contributor for code by <a
href="https://github.com/allcontributors"><code>@​allcontributors</code></a>[bot]
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1178">syrupy-project/syrupy#1178</a></li>
<li>chore(deps): update dependency hypothesis to v6.161.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1177">syrupy-project/syrupy#1177</a></li>
<li>chore(deps): update dependency hypothesis to v6.161.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1180">syrupy-project/syrupy#1180</a></li>
<li>chore(deps): update dependency hypothesis to v6.161.4 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1182">syrupy-project/syrupy#1182</a></li>
<li>chore(deps): update dependency hypothesis to v6.161.6 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1183">syrupy-project/syrupy#1183</a></li>
<li>chore(deps): update dependency ruff to &gt;=0.16,&lt;0.17 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1179">syrupy-project/syrupy#1179</a></li>
<li>chore(deps): update dependency hypothesis to v6.161.7 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1184">syrupy-project/syrupy#1184</a></li>
<li>chore(deps): update pypa/gh-action-pypi-publish action to v1.14.2 by
<a href="https://github.com/renovate"><code>@​renovate</code></a>[bot]
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1186">syrupy-project/syrupy#1186</a></li>
<li>perf: compress xdist snapshot reports by <a
href="https://github.com/w3lld1"><code>@​w3lld1</code></a> in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1188">syrupy-project/syrupy#1188</a></li>
<li>docs: add w3lld1 as a contributor for code by <a
href="https://github.com/allcontributors"><code>@​allcontributors</code></a>[bot]
in <a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1190">syrupy-project/syrupy#1190</a></li>
<li>chore(deps): update dependency ruff to v0.16.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1189">syrupy-project/syrupy#1189</a></li>
<li>chore(deps): update dependency hypothesis to v6.164.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1187">syrupy-project/syrupy#1187</a></li>
<li>chore(deps): update dependency hypothesis to v6.165.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1191">syrupy-project/syrupy#1191</a></li>
<li>chore(deps): update dependency coverage to v7.15.3 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1192">syrupy-project/syrupy#1192</a></li>
<li>chore(deps): update python docker tag to v3.14.7 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1195">syrupy-project/syrupy#1195</a></li>
<li>chore(deps): update dependency coverage to v7.15.4 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1197">syrupy-project/syrupy#1197</a></li>
<li>chore(deps): update dependency hypothesis to v6.165.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1194">syrupy-project/syrupy#1194</a></li>
<li>chore(deps): update dependency ruff to v0.16.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1198">syrupy-project/syrupy#1198</a></li>
<li>chore(deps): update dependency hypothesis to v6.165.3 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1199">syrupy-project/syrupy#1199</a></li>
<li>chore(deps): update astral-sh/setup-uv action to v10 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1200">syrupy-project/syrupy#1200</a></li>
<li>chore(deps): update dependency hypothesis to v6.165.5 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1201">syrupy-project/syrupy#1201</a></li>
<li>chore(deps): update dependency ruff to v0.16.3 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1202">syrupy-project/syrupy#1202</a></li>
<li>chore(deps): update astral-sh/setup-uv action to v10.0.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a>[bot] in
<a
href="https://redirect.github.com/syrupy-project/syrupy/pull/1205">syrupy-project/syrupy#1205</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/621af75dd8dfa3301b503099b204a3d874e787d7"><code>621af75</code></a>
chore(release): 6.0.0 [skip ci]</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/3a9f69182366401c372dd0a1690177e70e994fec"><code>3a9f691</code></a>
fix: single file snapshot no longer buffers in memory (<a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1223">#1223</a>)</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/ab13f8d4a9eeba10572a6a12f485f79a6e0a1b23"><code>ab13f8d</code></a>
chore: sponsorship (<a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1224">#1224</a>)</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/98f989c42a7c1c9cf49e031e9b97374bf97a6b6d"><code>98f989c</code></a>
feat: add --snapshot-declaration-order for respecting declaration order
(<a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1222">#1222</a>)</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/b549b4b6329cca03f871162748b3ea8597add1a3"><code>b549b4b</code></a>
feat: built-in support for Dataclasses (<a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1220">#1220</a>)</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/d34933fce2d8eb65c24a89f29f5900b413775b5e"><code>d34933f</code></a>
chore: use the benchmarks git branch (<a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1221">#1221</a>)</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/f6eda020d8671fc1648c0d94ed436805d5548978"><code>f6eda02</code></a>
chore(ci): permissions for gh-pages</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/a5ce0492e68525f499f5cb395e273d3ac5a1f8e3"><code>a5ce049</code></a>
chore(deps): update actions/configure-pages action to v6 (<a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1219">#1219</a>)</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/c0cb162f5fbaca6eeda43937152db314e0313c82"><code>c0cb162</code></a>
chore: update github pages</li>
<li><a
href="https://github.com/syrupy-project/syrupy/commit/4d59bde91c87f6a2fb3b476ea995246a43449bc2"><code>4d59bde</code></a>
chore: update docs for v6 release (<a
href="https://redirect.github.com/syrupy-project/syrupy/issues/1218">#1218</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/syrupy-project/syrupy/compare/v5.5.3...v6.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syrupy&package-manager=uv&previous-version=5.5.3&new-version=6.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

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>

Made by [Open
SWE](https://openswe.vercel.app/agents/0758e158-6746-5095-b8a0-7f69acf36b73)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: John Kennedy <65985482+jkennedyvz@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-09-02 09:40:09 +00:00
..

LangGraph Prebuilt

PyPI - Version PyPI - License PyPI - Downloads Twitter

To help you ship LangGraph apps to production faster, check out LangSmith. LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.

Quick Install

uv add langgraph

🤔 What is this?

This library defines high-level APIs for creating and executing LangGraph agents and tools. It includes prebuilt components such as create_react_agent, ToolNode, validation helpers, and Agent Inbox schemas.

📖 Documentation

For full documentation, see the API reference. For conceptual guides and tutorials, see the LangGraph Docs.

Important

This library is bundled with langgraph; most users should install langgraph instead of installing langgraph-prebuilt directly.

Agents

langgraph-prebuilt provides an implementation of a tool-calling ReAct-style agent - create_react_agent:

uv add langchain-anthropic
from langchain_anthropic import ChatAnthropic
from langgraph.prebuilt import create_react_agent


# Define the tools for the agent to use
def search(query: str):
    """Call to surf the web."""
    # This is a placeholder, but don't tell the LLM that...
    if "sf" in query.lower() or "san francisco" in query.lower():
        return "It's 60 degrees and foggy."
    return "It's 90 degrees and sunny."


tools = [search]
model = ChatAnthropic(model="claude-3-7-sonnet-latest")

app = create_react_agent(model, tools)
# run the agent
app.invoke(
    {"messages": [{"role": "user", "content": "what is the weather in sf"}]},
)

Tools

ToolNode

langgraph-prebuilt provides an implementation of a node that executes tool calls - ToolNode:

from langgraph.prebuilt import ToolNode
from langchain_core.messages import AIMessage


def search(query: str):
    """Call to surf the web."""
    # This is a placeholder, but don't tell the LLM that...
    if "sf" in query.lower() or "san francisco" in query.lower():
        return "It's 60 degrees and foggy."
    return "It's 90 degrees and sunny."


tool_node = ToolNode([search])
tool_calls = [
    {"name": "search", "args": {"query": "what is the weather in sf"}, "id": "1"}
]
ai_message = AIMessage(content="", tool_calls=tool_calls)
# execute tool call
tool_node.invoke({"messages": [ai_message]})

ValidationNode

langgraph-prebuilt provides an implementation of a node that validates tool calls against a pydantic schema - ValidationNode:

from pydantic import BaseModel, field_validator
from langgraph.prebuilt import ValidationNode
from langchain_core.messages import AIMessage


class SelectNumber(BaseModel):
    a: int

    @field_validator("a")
    def a_must_be_meaningful(cls, v):
        if v != 37:
            raise ValueError("Only 37 is allowed")
        return v


validation_node = ValidationNode([SelectNumber])
validation_node.invoke(
    {
        "messages": [
            AIMessage(
                "", tool_calls=[{"name": "SelectNumber", "args": {"a": 42}, "id": "1"}]
            )
        ]
    }
)

Agent Inbox

The library contains schemas for using the Agent Inbox with LangGraph agents. Learn more about how to use Agent Inbox here.

from langgraph.types import interrupt
from langgraph.prebuilt.interrupt import HumanInterrupt, HumanResponse

def my_graph_function():
    # Extract the last tool call from the `messages` field in the state
    tool_call = state["messages"][-1].tool_calls[0]
    # Create an interrupt
    request: HumanInterrupt = {
        "action_request": {
            "action": tool_call['name'],
            "args": tool_call['args']
        },
        "config": {
            "allow_ignore": True,
            "allow_respond": True,
            "allow_edit": False,
            "allow_accept": False
        },
        "description": _generate_email_markdown(state) # Generate a detailed markdown description.
    }
    # Send the interrupt request inside a list, and extract the first response
    response = interrupt([request])[0]
    if response['type'] == "response":
        # Do something with the response
    ...

📕 Releases & Versioning

See our Releases and Versioning policies.

💁 Contributing

As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.

For detailed information on how to contribute, see the Contributing Guide.