Files
langgraph/libs/prebuilt
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>William Fu-Hinthorn
82f9c09b95 chore(deps-dev): bump ruff from 0.14.7 to 0.14.11 in /libs/sdk-py (#6673)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.14.7 to 0.14.11.
<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.14.11</h2>
<h2>Release Notes</h2>
<p>Released on 2026-01-08.</p>
<h3>Preview features</h3>
<ul>
<li>Consolidate diagnostics for matched disable/enable suppression
comments (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22099">#22099</a>)</li>
<li>Report diagnostics for invalid/unmatched range suppression comments
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/21908">#21908</a>)</li>
<li>[<code>airflow</code>] Passing positional argument into
<code>airflow.lineage.hook.HookLineageCollector.create_asset</code> is
not allowed (<code>AIR303</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22046">#22046</a>)</li>
<li>[<code>refurb</code>] Mark <code>FURB192</code> fix as always unsafe
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/22210">#22210</a>)</li>
<li>[<code>ruff</code>] Add <code>non-empty-init-module</code>
(<code>RUF067</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22143">#22143</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Fix GitHub format for multi-line diagnostics (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22108">#22108</a>)</li>
<li>[<code>flake8-unused-arguments</code>] Mark <code>**kwargs</code> in
<code>TypeVar</code> as used (<code>ARG001</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22214">#22214</a>)</li>
</ul>
<h3>Rule changes</h3>
<ul>
<li>Add <code>help:</code> subdiagnostics for several Ruff rules that
can sometimes appear to disagree with <code>ty</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22331">#22331</a>)</li>
<li>[<code>pylint</code>] Demote <code>PLW1510</code> fix to
display-only (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22318">#22318</a>)</li>
<li>[<code>pylint</code>] Ignore identical members
(<code>PLR1714</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22220">#22220</a>)</li>
<li>[<code>pylint</code>] Improve diagnostic range for
<code>PLC0206</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22312">#22312</a>)</li>
<li>[<code>ruff</code>] Improve fix title for <code>RUF102</code>
invalid rule code (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22100">#22100</a>)</li>
<li>[<code>flake8-simplify</code>]: Avoid unnecessary builtins import
for <code>SIM105</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22358">#22358</a>)</li>
</ul>
<h3>Configuration</h3>
<ul>
<li>Allow Python 3.15 as valid <code>target-version</code> value in
preview (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22419">#22419</a>)</li>
<li>Check <code>required-version</code> before parsing rules (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22410">#22410</a>)</li>
<li>Include configured <code>src</code> directories when resolving
graphs (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22451">#22451</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Update <code>T201</code> suggestion to not use root logger to
satisfy <code>LOG015</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22059">#22059</a>)</li>
<li>Fix <code>iter</code> example in unsafe fixes doc (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22118">#22118</a>)</li>
<li>[<code>flake8_print</code>] better suggestion for
<code>basicConfig</code> in <code>T201</code> docs (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22101">#22101</a>)</li>
<li>[<code>pylint</code>] Restore the fix safety docs for
<code>PLW0133</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22211">#22211</a>)</li>
<li>Fix Jupyter notebook discovery info for editors (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22447">#22447</a>)</li>
</ul>
<h3>Contributors</h3>
<ul>
<li><a
href="https://github.com/charliermarsh"><code>@​charliermarsh</code></a></li>
<li><a href="https://github.com/ntBre"><code>@​ntBre</code></a></li>
<li><a
href="https://github.com/cenviity"><code>@​cenviity</code></a></li>
<li><a href="https://github.com/njhearp"><code>@​njhearp</code></a></li>
<li><a
href="https://github.com/cbachhuber"><code>@​cbachhuber</code></a></li>
<li><a
href="https://github.com/jelle-openai"><code>@​jelle-openai</code></a></li>
<li><a
href="https://github.com/AlexWaygood"><code>@​AlexWaygood</code></a></li>
</ul>
<!-- 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.14.11</h2>
<p>Released on 2026-01-08.</p>
<h3>Preview features</h3>
<ul>
<li>Consolidate diagnostics for matched disable/enable suppression
comments (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22099">#22099</a>)</li>
<li>Report diagnostics for invalid/unmatched range suppression comments
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/21908">#21908</a>)</li>
<li>[<code>airflow</code>] Passing positional argument into
<code>airflow.lineage.hook.HookLineageCollector.create_asset</code> is
not allowed (<code>AIR303</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22046">#22046</a>)</li>
<li>[<code>refurb</code>] Mark <code>FURB192</code> fix as always unsafe
(<a
href="https://redirect.github.com/astral-sh/ruff/pull/22210">#22210</a>)</li>
<li>[<code>ruff</code>] Add <code>non-empty-init-module</code>
(<code>RUF067</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22143">#22143</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Fix GitHub format for multi-line diagnostics (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22108">#22108</a>)</li>
<li>[<code>flake8-unused-arguments</code>] Mark <code>**kwargs</code> in
<code>TypeVar</code> as used (<code>ARG001</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22214">#22214</a>)</li>
</ul>
<h3>Rule changes</h3>
<ul>
<li>Add <code>help:</code> subdiagnostics for several Ruff rules that
can sometimes appear to disagree with <code>ty</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22331">#22331</a>)</li>
<li>[<code>pylint</code>] Demote <code>PLW1510</code> fix to
display-only (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22318">#22318</a>)</li>
<li>[<code>pylint</code>] Ignore identical members
(<code>PLR1714</code>) (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22220">#22220</a>)</li>
<li>[<code>pylint</code>] Improve diagnostic range for
<code>PLC0206</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22312">#22312</a>)</li>
<li>[<code>ruff</code>] Improve fix title for <code>RUF102</code>
invalid rule code (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22100">#22100</a>)</li>
<li>[<code>flake8-simplify</code>]: Avoid unnecessary builtins import
for <code>SIM105</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22358">#22358</a>)</li>
</ul>
<h3>Configuration</h3>
<ul>
<li>Allow Python 3.15 as valid <code>target-version</code> value in
preview (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22419">#22419</a>)</li>
<li>Check <code>required-version</code> before parsing rules (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22410">#22410</a>)</li>
<li>Include configured <code>src</code> directories when resolving
graphs (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22451">#22451</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Update <code>T201</code> suggestion to not use root logger to
satisfy <code>LOG015</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22059">#22059</a>)</li>
<li>Fix <code>iter</code> example in unsafe fixes doc (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22118">#22118</a>)</li>
<li>[<code>flake8_print</code>] better suggestion for
<code>basicConfig</code> in <code>T201</code> docs (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22101">#22101</a>)</li>
<li>[<code>pylint</code>] Restore the fix safety docs for
<code>PLW0133</code> (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22211">#22211</a>)</li>
<li>Fix Jupyter notebook discovery info for editors (<a
href="https://redirect.github.com/astral-sh/ruff/pull/22447">#22447</a>)</li>
</ul>
<h3>Contributors</h3>
<ul>
<li><a
href="https://github.com/charliermarsh"><code>@​charliermarsh</code></a></li>
<li><a href="https://github.com/ntBre"><code>@​ntBre</code></a></li>
<li><a
href="https://github.com/cenviity"><code>@​cenviity</code></a></li>
<li><a href="https://github.com/njhearp"><code>@​njhearp</code></a></li>
<li><a
href="https://github.com/cbachhuber"><code>@​cbachhuber</code></a></li>
<li><a
href="https://github.com/jelle-openai"><code>@​jelle-openai</code></a></li>
<li><a
href="https://github.com/AlexWaygood"><code>@​AlexWaygood</code></a></li>
<li><a
href="https://github.com/ValdonVitija"><code>@​ValdonVitija</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/c920cf8cdb247a9fd8e15a4c9d2efa838f7a78a3"><code>c920cf8</code></a>
Bump 0.14.11 (<a
href="https://redirect.github.com/astral-sh/ruff/issues/22462">#22462</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/bb757b5a79888f28264f629b5667a0514071f7d6"><code>bb757b5</code></a>
[ty] Don't show diagnostics for excluded files (<a
href="https://redirect.github.com/astral-sh/ruff/issues/22455">#22455</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/1f49e8ef518b75207e155595aba57acd48205078"><code>1f49e8e</code></a>
Include configured <code>src</code> directories when resolving graphs
(<a
href="https://redirect.github.com/astral-sh/ruff/issues/22451">#22451</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/701f5134ab7c1a860145dccc8abb3716a3f89fe7"><code>701f513</code></a>
[ty] Only consider fully static pivots when deriving transitive
constraints (...</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/eea9ad83528a7f492662f6427cdbb6fc2f655bb5"><code>eea9ad8</code></a>
Pin maturin version (<a
href="https://redirect.github.com/astral-sh/ruff/issues/22454">#22454</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/eeac2bd3eed2f4b8f4a71e0c945721481b25efc0"><code>eeac2bd</code></a>
[ty] Optimize union building for unions with many enum-literal members
(<a
href="https://redirect.github.com/astral-sh/ruff/issues/22363">#22363</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/7319c37f4eb063e9590e1f09c8e92d7dabc63403"><code>7319c37</code></a>
docs: fix jupyter notebook discovery info for editors (<a
href="https://redirect.github.com/astral-sh/ruff/issues/22447">#22447</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/805503c19a6b74c5803e10123077997e29a0da37"><code>805503c</code></a>
[<code>ruff</code>] Improve fix title for <code>RUF102</code> invalid
rule code (<a
href="https://redirect.github.com/astral-sh/ruff/issues/22100">#22100</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/68a2f6c57d70052d0805b46b0e3a2538598b856f"><code>68a2f6c</code></a>
[ty] Fix <code>super()</code> with TypeVar-annotated <code>self</code>
and <code>cls</code> parameter (<a
href="https://redirect.github.com/astral-sh/ruff/issues/22208">#22208</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff/commit/abaa735e1d027cf458a2ab83d8a422d74111580c"><code>abaa735</code></a>
[ty] Improve <code>UnionBuilder</code> performance by changing
<code>Type::is_subtype_of</code> cal...</li>
<li>Additional commits viewable in <a
href="https://github.com/astral-sh/ruff/compare/0.14.7...0.14.11">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ruff&package-manager=pip&previous-version=0.14.7&new-version=0.14.11)](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 merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com>
2026-01-31 00:14:16 -08: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
    ...