LangGraph

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

Testo originale della fonte · EN

Guarda in azione

Esempio dell’autore

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
Apri immagine intera
Licenza

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.
Esempio dell’autore

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
Apri immagine intera
Licenza

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.
Esempio dell’autore

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.

Input di esempio

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

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.
Esempio dell’autore

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.

Input di esempio

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

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.

Panoramica del prodotto

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

Testo originale della fonte · EN
FUNZIONI ELENCATE DALLA FONTE

Cosa offre LangGraph

  1. 01Compose deterministic and model-driven steps
  2. 02Persist and resume execution state
  3. 03Pause workflows for human input
Testo originale della fonte · EN
Cosa lo distingue

Cosa lo 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.

Testo originale della fonte · EN
A chi è adatto

A chi è adatto

  • Developers building stateful agent workflows
  • Teams needing resumable execution and human checkpoints
Testo originale della fonte · EN
PRIMA DI SCEGLIERE

Cosa verificare

  • Prova un’attività reale e confronta il risultato con le tue esigenze.
  • Controlla quali dati vengono conservati, condivisi o usati per l’addestramento.
  • Verifica prezzi, limiti d’uso e condizioni di cancellazione sul sito ufficiale.
Ultima verifica

Link ufficiale controllato il 9 nov 2026. Le funzioni non sono state testate in modo indipendente.

Correlati per attività

ProdottiPrezzoAccessoCASI D’USO
LangGraphNon verificatoAPIAutomatizzare i flussi di lavoro
LangChainGratisAPIAutomatizzare i flussi di lavoro
FlowiseNon verificatoAPIAutomatizzare i flussi di lavoro
PaperclipNon verificatoAPIAutomatizzare i flussi di lavoro
RestatePiani gratuiti e a pagamentoNon indicatoAutomatizzare i flussi di lavoro