Files
langgraph/libs/prebuilt
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>John Kennedy
6d6d989f11 chore(deps): bump the all-dependencies group in /libs/prebuilt with 2 updates (#7196)
Bumps the all-dependencies group in /libs/prebuilt with 2 updates:
[langchain-core](https://github.com/langchain-ai/langchain) and
[ruff](https://github.com/astral-sh/ruff).

Updates `langchain-core` from 1.2.17 to 1.2.19
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/langchain-ai/langchain/releases">langchain-core's
releases</a>.</em></p>
<blockquote>
<h2>langchain-core==1.2.19</h2>
<p>Changes since langchain-core==1.2.18</p>
<p>release(core): 1.2.19 (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35832">#35832</a>)
chore(core): move BaseCrossEncoder to langchain-core (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35809">#35809</a>)
chore: bump tornado from 6.5.2 to 6.5.5 in /libs/core (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35775">#35775</a>)</p>
<h2>langchain-core==1.2.18</h2>
<p>Changes since langchain-core==1.2.17</p>
<p>release(core): 1.2.18 (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35704">#35704</a>)
fix(core): fix double backticks in deprecation docstring for
alternative_import (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35658">#35658</a>)
fix(core): preserve default_factory when generating tool call schema (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35550">#35550</a>)
feat(openai): support tool search (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35582">#35582</a>)
chore: bump the minor-and-patch group across 3 directories with 7
updates (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35605">#35605</a>)</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/langchain-ai/langchain/commit/41cca203e633d8506b563f263b005cb52909300d"><code>41cca20</code></a>
release(core): 1.2.19 (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35832">#35832</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/307cdcac9e4e3d7cdcc86eeb3a4688b486f8e1d8"><code>307cdca</code></a>
chore(core): move BaseCrossEncoder to langchain-core (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35809">#35809</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/cee6430b1cd2530cdebcdb8820ed4ebf700556a4"><code>cee6430</code></a>
refactor(xai): remove redundant <code>lc_attributes</code> override (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35791">#35791</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/6b9b4c6546332346b787f337b92879fc9b6b530c"><code>6b9b4c6</code></a>
feat(xai): support <code>base_url</code> alias and
<code>XAI_API_BASE</code> env var (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35790">#35790</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/b676167707b9c8e27feef7e58a11edb0fe011703"><code>b676167</code></a>
fix(deepseek): accept <code>base_url</code> as alias for
<code>api_base</code> (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35789">#35789</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/5d9568b5f5a94ef21bee094f38694415e099ed73"><code>5d9568b</code></a>
feat(model-profiles): new fields + <code>Makefile</code> target (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35788">#35788</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/1891d414beceeef8e23a05e9e8f6011ccbf4d8b2"><code>1891d41</code></a>
chore: bump tornado from 6.5.2 to 6.5.5 in /libs/text-splitters (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35774">#35774</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/1d954bccfad779097f63688b324f82fed48f4c5e"><code>1d954bc</code></a>
chore: bump tornado from 6.5.2 to 6.5.5 in /libs/langchain (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35773">#35773</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/261b1d57e40b8470673d923b925aeed58415bc59"><code>261b1d5</code></a>
chore: bump tornado from 6.5.2 to 6.5.5 in /libs/core (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/35775">#35775</a>)</li>
<li><a
href="https://github.com/langchain-ai/langchain/commit/9521c679db9641912b97297d434adc8d000b5a9c"><code>9521c67</code></a>
fix(openai): close PIL Image handles in token counting to prevent fd
leak (<a
href="https://redirect.github.com/langchain-ai/langchain/issues/3">#3</a>...</li>
<li>Additional commits viewable in <a
href="https://github.com/langchain-ai/langchain/compare/langchain-core==1.2.17...langchain-core==1.2.19">compare
view</a></li>
</ul>
</details>
<br />

Updates `ruff` from 0.15.5 to 0.15.6
<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.6</h2>
<h2>Release Notes</h2>
<p>Released on 2026-03-12.</p>
<h3>Preview features</h3>
<ul>
<li>Add support for <code>lazy</code> import parsing (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23755">#23755</a>)</li>
<li>Add support for star-unpacking of comprehensions (PEP 798) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23788">#23788</a>)</li>
<li>Reject semantic syntax errors for lazy imports (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23757">#23757</a>)</li>
<li>Drop a few rules from the preview default set (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23879">#23879</a>)</li>
<li>[<code>airflow</code>] Flag <code>Variable.get()</code> calls
outside of task execution context (<code>AIR003</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23584">#23584</a>)</li>
<li>[<code>airflow</code>] Flag runtime-varying values in DAG/task
constructor arguments (<code>AIR304</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23631">#23631</a>)</li>
<li>[<code>flake8-bugbear</code>] Implement
<code>delattr-with-constant</code> (<code>B043</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23737">#23737</a>)</li>
<li>[<code>flake8-tidy-imports</code>] Add <code>TID254</code> to
enforce lazy imports (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23777">#23777</a>)</li>
<li>[<code>flake8-tidy-imports</code>] Allow users to ban lazy imports
with <code>TID254</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23847">#23847</a>)</li>
<li>[<code>isort</code>] Retain <code>lazy</code> keyword when sorting
imports (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23762">#23762</a>)</li>
<li>[<code>pyupgrade</code>] Add <code>from __future__ import
annotations</code> automatically (<code>UP006</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23260">#23260</a>)</li>
<li>[<code>refurb</code>] Support <code>newline</code> parameter in
<code>FURB101</code> for Python 3.13+ (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23754">#23754</a>)</li>
<li>[<code>ruff</code>] Add <code>os-path-commonprefix</code>
(<code>RUF071</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23814">#23814</a>)</li>
<li>[<code>ruff</code>] Add unsafe fix for os-path-commonprefix
(<code>RUF071</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23852">#23852</a>)</li>
<li>[<code>ruff</code>] Limit <code>RUF036</code> to typing contexts;
make it unsafe for non-typing-only (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23765">#23765</a>)</li>
<li>[<code>ruff</code>] Use starred unpacking for <code>RUF017</code> in
Python 3.15+ (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23789">#23789</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Fix <code>--add-noqa</code> creating unwanted leading whitespace (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23773">#23773</a>)</li>
<li>Fix <code>--add-noqa</code> breaking shebangs (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23577">#23577</a>)</li>
<li>[formatter] Fix lambda body formatting for multiline calls and
subscripts (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23866">#23866</a>)</li>
<li>[formatter] Preserve required annotation parentheses in annotated
assignments (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23865">#23865</a>)</li>
<li>[formatter] Preserve type-expression parentheses in the formatter
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/23867">#23867</a>)</li>
<li>[<code>flake8-annotations</code>] Fix stack overflow in
<code>ANN401</code> on quoted annotations with escape sequences (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23912">#23912</a>)</li>
<li>[<code>pep8-naming</code>] Check naming conventions in
<code>match</code> pattern bindings (<code>N806</code>,
<code>N815</code>, <code>N816</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23899">#23899</a>)</li>
<li>[<code>perflint</code>] Fix comment duplication in fixes
(<code>PERF401</code>, <code>PERF403</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23729">#23729</a>)</li>
<li>[<code>pyupgrade</code>] Properly trigger <code>super</code> change
in nested class (<code>UP008</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22677">#22677</a>)</li>
<li>[<code>ruff</code>] Avoid syntax errors in <code>RUF036</code> fixes
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/23764">#23764</a>)</li>
</ul>
<h3>Rule changes</h3>
<ul>
<li>[<code>flake8-bandit</code>] Flag <code>S501</code> with
<code>requests.request</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23873">#23873</a>)</li>
<li>[<code>flake8-executable</code>] Fix WSL detection in non-Docker
containers (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22879">#22879</a>)</li>
<li>[<code>flake8-print</code>] Ignore <code>pprint</code> calls with
<code>stream=</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23787">#23787</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Update docs for Markdown code block formatting (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23871">#23871</a>)</li>
<li>[<code>flake8-bugbear</code>] Fix misleading description for
<code>B904</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23731">#23731</a>)</li>
</ul>
<h3>Contributors</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.6</h2>
<p>Released on 2026-03-12.</p>
<h3>Preview features</h3>
<ul>
<li>Add support for <code>lazy</code> import parsing (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23755">#23755</a>)</li>
<li>Add support for star-unpacking of comprehensions (PEP 798) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23788">#23788</a>)</li>
<li>Reject semantic syntax errors for lazy imports (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23757">#23757</a>)</li>
<li>Drop a few rules from the preview default set (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23879">#23879</a>)</li>
<li>[<code>airflow</code>] Flag <code>Variable.get()</code> calls
outside of task execution context (<code>AIR003</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23584">#23584</a>)</li>
<li>[<code>airflow</code>] Flag runtime-varying values in DAG/task
constructor arguments (<code>AIR304</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23631">#23631</a>)</li>
<li>[<code>flake8-bugbear</code>] Implement
<code>delattr-with-constant</code> (<code>B043</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23737">#23737</a>)</li>
<li>[<code>flake8-tidy-imports</code>] Add <code>TID254</code> to
enforce lazy imports (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23777">#23777</a>)</li>
<li>[<code>flake8-tidy-imports</code>] Allow users to ban lazy imports
with <code>TID254</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23847">#23847</a>)</li>
<li>[<code>isort</code>] Retain <code>lazy</code> keyword when sorting
imports (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23762">#23762</a>)</li>
<li>[<code>pyupgrade</code>] Add <code>from __future__ import
annotations</code> automatically (<code>UP006</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23260">#23260</a>)</li>
<li>[<code>refurb</code>] Support <code>newline</code> parameter in
<code>FURB101</code> for Python 3.13+ (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23754">#23754</a>)</li>
<li>[<code>ruff</code>] Add <code>os-path-commonprefix</code>
(<code>RUF071</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23814">#23814</a>)</li>
<li>[<code>ruff</code>] Add unsafe fix for os-path-commonprefix
(<code>RUF071</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23852">#23852</a>)</li>
<li>[<code>ruff</code>] Limit <code>RUF036</code> to typing contexts;
make it unsafe for non-typing-only (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23765">#23765</a>)</li>
<li>[<code>ruff</code>] Use starred unpacking for <code>RUF017</code> in
Python 3.15+ (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23789">#23789</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Fix <code>--add-noqa</code> creating unwanted leading whitespace (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23773">#23773</a>)</li>
<li>Fix <code>--add-noqa</code> breaking shebangs (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23577">#23577</a>)</li>
<li>[formatter] Fix lambda body formatting for multiline calls and
subscripts (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23866">#23866</a>)</li>
<li>[formatter] Preserve required annotation parentheses in annotated
assignments (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23865">#23865</a>)</li>
<li>[formatter] Preserve type-expression parentheses in the formatter
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/23867">#23867</a>)</li>
<li>[<code>flake8-annotations</code>] Fix stack overflow in
<code>ANN401</code> on quoted annotations with escape sequences (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23912">#23912</a>)</li>
<li>[<code>pep8-naming</code>] Check naming conventions in
<code>match</code> pattern bindings (<code>N806</code>,
<code>N815</code>, <code>N816</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23899">#23899</a>)</li>
<li>[<code>perflint</code>] Fix comment duplication in fixes
(<code>PERF401</code>, <code>PERF403</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23729">#23729</a>)</li>
<li>[<code>pyupgrade</code>] Properly trigger <code>super</code> change
in nested class (<code>UP008</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22677">#22677</a>)</li>
<li>[<code>ruff</code>] Avoid syntax errors in <code>RUF036</code> fixes
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/23764">#23764</a>)</li>
</ul>
<h3>Rule changes</h3>
<ul>
<li>[<code>flake8-bandit</code>] Flag <code>S501</code> with
<code>requests.request</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23873">#23873</a>)</li>
<li>[<code>flake8-executable</code>] Fix WSL detection in non-Docker
containers (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22879">#22879</a>)</li>
<li>[<code>flake8-print</code>] Ignore <code>pprint</code> calls with
<code>stream=</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23787">#23787</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Update docs for Markdown code block formatting (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23871">#23871</a>)</li>
<li>[<code>flake8-bugbear</code>] Fix misleading description for
<code>B904</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/23731">#23731</a>)</li>
</ul>
<h3>Contributors</h3>
<ul>
<li><a href="https://github.com/zsol"><code>@​zsol</code></a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/astral-sh/ruff/commit/e4c7f357777a2fdd34dbe6a98b1b7d3e7488f675"><code>e4c7f35</code></a>
Bump 0.15.6 (<a
href="https://redirect.github.com/astral-sh/ruff/issues/23919">#23919</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/edfe6c17a493669227da45ce7edc786208d9d0b0"><code>edfe6c1</code></a>
[ty] Narrow type context during collection literal inference (<a
href="https://redirect.github.com/astral-sh/ruff/issues/23844">#23844</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/dd16d689abd9d0fa1caf4316e70479fd422b6142"><code>dd16d68</code></a>
Exclude broken symlink in ecosystem check (<a
href="https://redirect.github.com/astral-sh/ruff/issues/23921">#23921</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/3f94c6ac6397cdc3160459d9d6e3892e3f3242dd"><code>3f94c6a</code></a>
Fix stack overflow in ANN401 on quoted annotations with escape sequences
(<a
href="https://redirect.github.com/astral-sh/ruff/issues/23">#23</a>...</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/91fc7bd3f936974d7107ba8fd0668bc251a55c58"><code>91fc7bd</code></a>
[ty] Fix false-positive diagnostics for PEP-604 union annotations on
attribut...</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/04229cffb44dfe8c64a0879eb3cea472a08d1565"><code>04229cf</code></a>
[ty] Initial test suite for PEP-728 <code>TypedDict</code> features (<a
href="https://redirect.github.com/astral-sh/ruff/issues/23832">#23832</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/728b9d6fd300d492fc2572bcfade170141296f97"><code>728b9d6</code></a>
[<code>pep8-naming</code>] Check naming conventions in
<code>match</code> pattern bindings (<code>N806</code>,...</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/88d1eecd261679fc9d1d10f30d814230a7f28513"><code>88d1eec</code></a>
[ty] Ensure a <code>type[]</code> type <code>T</code> is always
considered assignable to a union th...</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/37cdd61406ad4965847c9baa7c3f6ca633887d68"><code>37cdd61</code></a>
Fix lambda body formatting for multiline calls and subscripts (<a
href="https://redirect.github.com/astral-sh/ruff/issues/23866">#23866</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/a25a4df54aca67d23b4867ddad634fe0768fd6a2"><code>a25a4df</code></a>
[ty] Disambiguate duplicate-looking overloaded callables in union
display (<a
href="https://redirect.github.com/astral-sh/ruff/issues/2">#2</a>...</li>
<li>Additional commits viewable in <a
href="https://github.com/astral-sh/ruff/compare/0.15.5...0.15.6">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>
Co-authored-by: John Kennedy <65985482+jkennedyvz@users.noreply.github.com>
2026-03-17 20:14:29 +00:00
..

LangGraph Prebuilt

This library defines high-level APIs for creating and executing LangGraph agents and tools.

Important

This library is meant to be bundled with langgraph, don't install it directly

Agents

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

pip install 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
    ...