LangGraph

LangGraph is an orchestration framework for building stateful agents with explicit workflow graphs, persistent execution and human review points

Originaltext der Quelle · EN

In Aktion ansehen

Beispiel des Autors

Author diagram: chained calls with a gate

Original documentation illustration of calls linked by a gate. It explains a workflow pattern; it is not a product interface, an executed trace or a measured quality result.

LangGraph author diagram showing an input, LLM call, gate and subsequent calls
Ganzes Bild öffnen
Lizenz

Complete source PNG converted losslessly to WebP without crop or resize.

MIT License

Copyright (c) 2025 LangChain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Beispiel des Autors

Author diagram: parallel calls and aggregation

Original documentation illustration of parallel calls joined by an aggregator. The image shows structure; no independent timing or reliability comparison is implied.

LangGraph author diagram showing three parallel LLM calls and an aggregator
Ganzes Bild öffnen
Lizenz

Complete source PNG converted losslessly to WebP without crop or resize.

MIT License

Copyright (c) 2025 LangChain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Beispiel des Autors

Source example: pause and resume an approval

Complete Python source routes an in-memory approval to proceed or cancel, then resumes the same thread. The Transfer $500 string is dummy action text: no payment is implemented. Requires compatible LangGraph; production needs durable persistence. Source assertions/prints are not site-run results.

Beispieleingabe

# :snippet-start: langgraph-interrupts-approval-py
from typing import Literal, Optional, TypedDict

from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import END, START, StateGraph
from langgraph.types import Command, interrupt


class ApprovalState(TypedDict):
    action_details: str
    status: Optional[Literal["pending", "approved", "rejected"]]


def approval_node(state: ApprovalState) -> Command[Literal["proceed", "cancel"]]:
    # Expose details so the caller can render them in a UI
    decision = interrupt(
        {
            "question": "Approve this action?",
            "details": state["action_details"],
        }
    )

    # Route to the appropriate node after resume
    return Command(goto="proceed" if decision else "cancel")


def proceed_node(state: ApprovalState):
    return {"status": "approved"}


def cancel_node(state: ApprovalState):
    return {"status": "rejected"}


builder = StateGraph(ApprovalState)
builder.add_node("approval", approval_node)
builder.add_node("proceed", proceed_node)
builder.add_node("cancel", cancel_node)
builder.add_edge(START, "approval")
builder.add_edge("proceed", END)
builder.add_edge("cancel", END)

# Use a more durable checkpointer in production
checkpointer = InMemorySaver()
graph = builder.compile(checkpointer=checkpointer)

config = {"configurable": {"thread_id": "approval-123"}}
initial = graph.stream_events(
    {"action_details": "Transfer $500", "status": "pending"},
    config=config,
    version="v3",
)
_ = initial.output  # drive the stream to completion
print(initial.interrupts)  # -> (Interrupt(value={'question': ..., 'details': ...}),)

# Resume with the decision; True routes to proceed, False to cancel
resumed = graph.stream_events(Command(resume=True), config=config, version="v3")
print(resumed.output["status"])
# :snippet-end:

# :remove-start:
if __name__ == "__main__":
    assert resumed.output["status"] == "approved"
    print("✓ langgraph-interrupts-approval")
# :remove-end:
Lizenz

Complete original source file/block(s) unchanged. Outer README fence omitted for copying; grouped complete files keep their own language fences. Editorial title/prerequisites added. Nothing executed.

MIT License

Copyright (c) 2025 LangChain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Beispiel des Autors

Source example: tool state and run context

Complete Python source passes a user ID in graph state and an organization ID in per-run context to a ToolNode. Uses an authored tool-call message and sample identifiers, without a model or real user lookup. Requires LangChain/LangGraph; the included assertions are unexecuted.

Beispieleingabe

# :snippet-start: workflows-agents-tool-runtime-state-context-py
from dataclasses import dataclass

from langchain.messages import AIMessage
from langchain.tools import ToolRuntime, tool
from langgraph.graph import MessagesState, START, StateGraph
from langgraph.prebuilt import ToolNode


class State(MessagesState):
    user_id: str


@dataclass
class Context:
    organization_id: str


@tool
def get_user_info(runtime: ToolRuntime[Context, State]) -> str:
    """Look up user information."""
    # Read the current graph state passed to the ToolNode.
    user_id = runtime.state["user_id"]

    # Read explicit per-run values that are not part of graph state.
    organization_id = runtime.context.organization_id

    return f"User {user_id} in organization {organization_id}"


builder = StateGraph(State, context_schema=Context)
builder.add_node("tools", ToolNode([get_user_info]))
builder.add_edge(START, "tools")
graph = builder.compile()

result = graph.invoke(
    {
        "messages": [
            AIMessage(
                content="",
                tool_calls=[
                    {
                        "name": "get_user_info",
                        "args": {},
                        "id": "call_user_info",
                    }
                ],
            )
        ],
        "user_id": "user_123",
    },
    context=Context(organization_id="org_456"),
)
# :snippet-end:

# :remove-start:
if __name__ == "__main__":
    expected = "User user_123 in organization org_456"
    contents = [str(getattr(message, "content", "")) for message in result["messages"]]
    assert any(expected in content for content in contents), contents
    print("✓ workflows-agents tool runtime state/context sample completed")
# :remove-end:
Lizenz

Complete original source file/block(s) unchanged. Outer README fence omitted for copying; grouped complete files keep their own language fences. Editorial title/prerequisites added. Nothing executed.

MIT License

Copyright (c) 2025 LangChain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Produktüberblick

LangChain is the agent framework: abstractions and integrations for models, tools, and agent loops.

Originaltext der Quelle · EN
IN DER QUELLE GENANNTE FUNKTIONEN

Was LangGraph bietet

  1. 01Compose deterministic and model-driven steps
  2. 02Persist and resume execution state
  3. 03Pause workflows for human input
Originaltext der Quelle · EN
Was es unterscheidet

Was es unterscheidet

It provides lower-level orchestration primitives rather than a prebuilt conversational assistant. LangChain integrations are optional; developers define the state, transitions and tools their workflow requires.

Originaltext der Quelle · EN
Für wen es geeignet ist

Für wen es geeignet ist

  • Developers building stateful agent workflows
  • Teams needing resumable execution and human checkpoints
Originaltext der Quelle · EN
VOR DER AUSWAHL

Was zu prüfen ist

  • Eine echte Aufgabe testen und das Ergebnis mit den Anforderungen vergleichen.
  • Prüfen, welche Daten gespeichert, weitergegeben oder zum Training genutzt werden.
  • Aktuelle Preise, Nutzungslimits und Kündigungsbedingungen auf der offiziellen Website prüfen.
Zuletzt geprüft

Offizieller Link am 9. Nov. 2026 geprüft. Funktionsangaben wurden nicht unabhängig getestet.

Verwandte Aufgaben

ProduktePreisZugangANWENDUNGEN
LangGraphNicht verifiziertAPIArbeitsabläufe automatisieren
LangChainKostenlosAPIArbeitsabläufe automatisieren
FlowiseNicht verifiziertAPIArbeitsabläufe automatisieren
PaperclipNicht verifiziertAPIArbeitsabläufe automatisieren
RestateGratis- und BezahlpläneNicht angegebenArbeitsabläufe automatisieren