LangGraph

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

Texte original de la source · EN
Visiter le site

Voir en action

Exemple de l’auteur

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
Voir l’image entière
Licence

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.
Exemple de l’auteur

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
Voir l’image entière
Licence

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.
Exemple de l’auteur

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.

Exemple d’entrée

# :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:
Licence

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.
Exemple de l’auteur

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.

Exemple d’entrée

# :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:
Licence

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.

Présentation du produit

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

Texte original de la source · EN
FONCTIONS INDIQUÉES PAR LA SOURCE

Ce que propose LangGraph

  1. 01Compose deterministic and model-driven steps
  2. 02Persist and resume execution state
  3. 03Pause workflows for human input
Texte original de la source · EN
Ce qui le distingue

Ce qui le distingue

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.

Texte original de la source · EN
À qui il convient

À qui il convient

  • Developers building stateful agent workflows
  • Teams needing resumable execution and human checkpoints
Texte original de la source · EN
AVANT DE CHOISIR

Points à vérifier

  • Tester une vraie tâche et comparer le résultat à ses besoins.
  • Vérifier quelles données sont conservées, partagées ou utilisées pour l’entraînement.
  • Confirmer les tarifs, limites d’usage et conditions de résiliation sur le site officiel.
Dernière vérification

Lien officiel vérifié le 9 nov. 2026. Les fonctionnalités n’ont pas été testées indépendamment.

Tâches connexes

ProduitsPrixAccèsCAS D’USAGE
LangGraphNon vérifiéAPIAutomatiser un flux de travail
LangChainGratuitAPIAutomatiser un flux de travail
FlowiseNon vérifiéAPIAutomatiser un flux de travail
PaperclipNon vérifiéAPIAutomatiser un flux de travail
RestateOffres gratuites et payantesNon indiquéAutomatiser un flux de travail