mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-22 15:42:25 +02:00
b221842392
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.19 to 1.2.20 <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.20</h2> <p>Changes since langchain-core==1.2.19</p> <p>release(core): 1.2.20 (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36085">#36085</a>) fix(core): trace invocation params in metadata (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36080">#36080</a>) feat: Add LangSmith integration metadata to create_agent and init_chat_model (<a href="https://redirect.github.com/langchain-ai/langchain/issues/35810">#35810</a>) feat(core): harden anti-ssrf (<a href="https://redirect.github.com/langchain-ai/langchain/issues/35960">#35960</a>) ci: avoid unnecessary dep installs in lint targets (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36046">#36046</a>) docs(core): document <code>base_url</code> in mermaid api (<a href="https://redirect.github.com/langchain-ai/langchain/issues/35961">#35961</a>) chore: bump orjson from 3.11.5 to 3.11.6 in /libs/core (<a href="https://redirect.github.com/langchain-ai/langchain/issues/35805">#35805</a>) chore: housekeeping (<a href="https://redirect.github.com/langchain-ai/langchain/issues/35850">#35850</a>)</p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/langchain-ai/langchain/commit/c4abc91ed96eaa27dc62676785b502982f02db6b"><code>c4abc91</code></a> release(core): 1.2.20 (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36085">#36085</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/70c88c0e723a5d9477d13f4b6ba8893e40b76f50"><code>70c88c0</code></a> fix(core): trace invocation params in metadata (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36080">#36080</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/2319fdc9788e526103f079bde9acecfe4a6a3958"><code>2319fdc</code></a> feat: Add LangSmith integration metadata to create_agent and init_chat_model ...</li> <li><a href="https://github.com/langchain-ai/langchain/commit/dd136337d78e9375ecc95fe29c69e93689c9b39c"><code>dd13633</code></a> feat(core): harden anti-ssrf (<a href="https://redirect.github.com/langchain-ai/langchain/issues/35960">#35960</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/cf1f510d7742e68be1718a4034225eeb14da171b"><code>cf1f510</code></a> fix(infra): resolve module crash blocking external PR enforcement (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36059">#36059</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/54a5f83f2eba06b9ef30170a98236723f05df3a0"><code>54a5f83</code></a> ci(infra): drop redundant opened trigger from issue-link check (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36054">#36054</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/a81203bf6a08ae65b7ed3832448558570e2208f9"><code>a81203b</code></a> ci: decouple codspeed from ci gate (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36051">#36051</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/67f5e317d3887d9c713929ade619ab50e5556072"><code>67f5e31</code></a> chore(text-splitters): speed up ci (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36050">#36050</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/b7e0b41d3af76e79a91ec0f9b9aee92fb8a98df0"><code>b7e0b41</code></a> ci: use codspeed <code>walltime</code> mode for slow partners (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36049">#36049</a>)</li> <li><a href="https://github.com/langchain-ai/langchain/commit/2476f558ad00f569680f25f18e57140d024db951"><code>2476f55</code></a> ci: replace deprecated codspeed <code>instrumentation</code> mode with <code>simulation</code> (<a href="https://redirect.github.com/langchain-ai/langchain/issues/36">#36</a>...</li> <li>Additional commits viewable in <a href="https://github.com/langchain-ai/langchain/compare/langchain-core==1.2.19...langchain-core==1.2.20">compare view</a></li> </ul> </details> <br /> Updates `ruff` from 0.15.6 to 0.15.7 <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.7</h2> <h2>Release Notes</h2> <p>Released on 2026-03-19.</p> <h3>Preview features</h3> <ul> <li>Display output severity in preview (<a href="https://redirect.github.com/astral-sh/ruff/pull/23845">#23845</a>)</li> <li>Don't show <code>noqa</code> hover for non-Python documents (<a href="https://redirect.github.com/astral-sh/ruff/pull/24040">#24040</a>)</li> </ul> <h3>Rule changes</h3> <ul> <li>[<code>pycodestyle</code>] Recognize <code>pyrefly:</code> as a pragma comment (<code>E501</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/24019">#24019</a>)</li> </ul> <h3>Server</h3> <ul> <li>Don't return code actions for non-Python documents (<a href="https://redirect.github.com/astral-sh/ruff/pull/23905">#23905</a>)</li> </ul> <h3>Documentation</h3> <ul> <li>Add company AI policy to contributing guide (<a href="https://redirect.github.com/astral-sh/ruff/pull/24021">#24021</a>)</li> <li>Document editor features for Markdown code formatting (<a href="https://redirect.github.com/astral-sh/ruff/pull/23924">#23924</a>)</li> <li>[<code>pylint</code>] Improve phrasing (<code>PLC0208</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/24033">#24033</a>)</li> </ul> <h3>Other changes</h3> <ul> <li>Use PEP 639 license information (<a href="https://redirect.github.com/astral-sh/ruff/pull/19661">#19661</a>)</li> </ul> <h3>Contributors</h3> <ul> <li><a href="https://github.com/tmimmanuel"><code>@tmimmanuel</code></a></li> <li><a href="https://github.com/DimitriPapadopoulos"><code>@DimitriPapadopoulos</code></a></li> <li><a href="https://github.com/amyreese"><code>@amyreese</code></a></li> <li><a href="https://github.com/statxc"><code>@statxc</code></a></li> <li><a href="https://github.com/dylwil3"><code>@dylwil3</code></a></li> <li><a href="https://github.com/hunterhogan"><code>@hunterhogan</code></a></li> <li><a href="https://github.com/renovate"><code>@renovate</code></a></li> </ul> <h2>Install ruff 0.15.7</h2> <h3>Install prebuilt binaries via shell script</h3> <pre lang="sh"><code>curl --proto '=https' --tlsv1.2 -LsSf https://releases.astral.sh/github/ruff/releases/download/0.15.7/ruff-installer.sh | sh </code></pre> <h3>Install prebuilt binaries via powershell script</h3> <pre lang="sh"><code>powershell -ExecutionPolicy Bypass -c "irm https://releases.astral.sh/github/ruff/releases/download/0.15.7/ruff-installer.ps1 | iex" </tr></table> </code></pre> </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.7</h2> <p>Released on 2026-03-19.</p> <h3>Preview features</h3> <ul> <li>Display output severity in preview (<a href="https://redirect.github.com/astral-sh/ruff/pull/23845">#23845</a>)</li> <li>Don't show <code>noqa</code> hover for non-Python documents (<a href="https://redirect.github.com/astral-sh/ruff/pull/24040">#24040</a>)</li> </ul> <h3>Rule changes</h3> <ul> <li>[<code>pycodestyle</code>] Recognize <code>pyrefly:</code> as a pragma comment (<code>E501</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/24019">#24019</a>)</li> </ul> <h3>Server</h3> <ul> <li>Don't return code actions for non-Python documents (<a href="https://redirect.github.com/astral-sh/ruff/pull/23905">#23905</a>)</li> </ul> <h3>Documentation</h3> <ul> <li>Add company AI policy to contributing guide (<a href="https://redirect.github.com/astral-sh/ruff/pull/24021">#24021</a>)</li> <li>Document editor features for Markdown code formatting (<a href="https://redirect.github.com/astral-sh/ruff/pull/23924">#23924</a>)</li> <li>[<code>pylint</code>] Improve phrasing (<code>PLC0208</code>) (<a href="https://redirect.github.com/astral-sh/ruff/pull/24033">#24033</a>)</li> </ul> <h3>Other changes</h3> <ul> <li>Use PEP 639 license information (<a href="https://redirect.github.com/astral-sh/ruff/pull/19661">#19661</a>)</li> </ul> <h3>Contributors</h3> <ul> <li><a href="https://github.com/tmimmanuel"><code>@tmimmanuel</code></a></li> <li><a href="https://github.com/DimitriPapadopoulos"><code>@DimitriPapadopoulos</code></a></li> <li><a href="https://github.com/amyreese"><code>@amyreese</code></a></li> <li><a href="https://github.com/statxc"><code>@statxc</code></a></li> <li><a href="https://github.com/dylwil3"><code>@dylwil3</code></a></li> <li><a href="https://github.com/hunterhogan"><code>@hunterhogan</code></a></li> <li><a href="https://github.com/renovate"><code>@renovate</code></a></li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/astral-sh/ruff/commit/0ef39de46c006994fb1e90f7bd4ba09c0b2c1f79"><code>0ef39de</code></a> Bump 0.15.7 (<a href="https://redirect.github.com/astral-sh/ruff/issues/24049">#24049</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/beb543b5c666be9fd3f13c88df818f202b63e9d0"><code>beb543b</code></a> [ty] ecosystem-analyzer: Fail on newly panicking projects (<a href="https://redirect.github.com/astral-sh/ruff/issues/24043">#24043</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/378fe730929ccd67a7f2426b3012093da814b31d"><code>378fe73</code></a> Don't show noqa hover for non-Python documents (<a href="https://redirect.github.com/astral-sh/ruff/issues/24040">#24040</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/b5665bd18eecab4d3b5ab1256b36904cd99a4c57"><code>b5665bd</code></a> [<code>pylint</code>] Improve phrasing (<code>PLC0208</code>) (<a href="https://redirect.github.com/astral-sh/ruff/issues/24033">#24033</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/6e20f2219020e61eeae29458013d2d3684f75a79"><code>6e20f22</code></a> test: migrate <code>show_settings</code> and <code>version</code> tests to use <code>CliTest</code> (<a href="https://redirect.github.com/astral-sh/ruff/issues/23702">#23702</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/f99b284c1fe1399a82da7f6669467488017d44a7"><code>f99b284</code></a> Drain file watcher events during test setup (<a href="https://redirect.github.com/astral-sh/ruff/issues/24030">#24030</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/744c996c35016a8c0e05aa2823f4f822ac7b842c"><code>744c996</code></a> [ty] Filter out unsatisfiable inference attempts during generic call narrowin...</li> <li><a href="https://github.com/astral-sh/ruff/commit/16160958bdafb6106b6fffc72ffe2e4db0c0ac33"><code>1616095</code></a> [ty] Avoid inferring intersection types for call arguments (<a href="https://redirect.github.com/astral-sh/ruff/issues/23933">#23933</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/7f275f431bf8c60d59601b74d441e9f4bef89f35"><code>7f275f4</code></a> [ty] Pin mypy_primer in <code>setup_primer_project.py</code> (<a href="https://redirect.github.com/astral-sh/ruff/issues/24020">#24020</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/7255e362e4b171a641222279cd28d2ca88a74fdc"><code>7255e36</code></a> [<code>pycodestyle</code>] Recognize <code>pyrefly:</code> as a pragma comment (<code>E501</code>) (<a href="https://redirect.github.com/astral-sh/ruff/issues/24019">#24019</a>)</li> <li>Additional commits viewable in <a href="https://github.com/astral-sh/ruff/compare/0.15.6...0.15.7">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 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
...