# Langgraph > Documentation for Langgraph ## Pages - [Langgraph Documentation](langgraph-documentation.md): how-tos/use-remote-graph.md - [How to interact with the deployment using RemoteGraph](how-to-interact-with-the-deployment-using-remotegraph.md): !!! info "Prerequisites" - [invoke the graph](invoke-the-graph.md): result = await remote_graph.ainvoke({ - [stream outputs from the graph](stream-outputs-from-the-graph.md): async for chunk in remote_graph.astream({ - [invoke the graph](invoke-the-graph-2.md): result = remote_graph.invoke({ - [stream outputs from the graph](stream-outputs-from-the-graph-2.md): for chunk in remote_graph.stream({ - [create a thread (or use an existing thread instead)](create-a-thread-or-use-an-existing-thread-instead.md): thread = sync_client.threads.create() - [invoke the graph with the thread config](invoke-the-graph-with-the-thread-config.md): config = {"configurable": {"thread_id": thread["thread_id"]}} - [verify that the state was persisted to the thread](verify-that-the-state-was-persisted-to-the-thread.md): thread_state = remote_graph.get_state(config) - [define parent graph](define-parent-graph.md): builder = StateGraph(MessagesState) - [add remote graph directly as a node](add-remote-graph-directly-as-a-node.md): builder.add_node("child", remote_graph) - [invoke the parent graph](invoke-the-parent-graph.md): result = graph.invoke({ - [stream outputs from both the parent graph and subgraph](stream-outputs-from-both-the-parent-graph-and-subgraph.md): for chunk in graph.stream({ - [How to integrate LangGraph with AutoGen, CrewAI, and other frameworks](how-to-integrate-langgraph-with-autogen-crewai-and-other-frameworks.md): This guide shows how to integrate AutoGen agents with LangGraph to leverage features like persistence, streaming, and... - [Create the graph with memory for persistence](create-the-graph-with-memory-for-persistence.md): checkpointer = InMemorySaver() - [Build the graph](build-the-graph.md): builder = StateGraph(MessagesState) - [Compile with checkpointer for persistence](compile-with-checkpointer-for-persistence.md): graph = builder.compile(checkpointer=checkpointer) - [pass the thread ID to persist agent outputs for future interactions](pass-the-thread-id-to-persist-agent-outputs-for-future-interactions.md): config = {"configurable": {"thread_id": "1"}} - [Enable tracing for your application](enable-tracing-for-your-application.md): To enable [tracing](../concepts/tracing.md) for your application, set the following environment variables: - [How to use the graph API](how-to-use-the-graph-api.md): This guide demonstrates the basics of LangGraph's Graph API. It walks through state, as w... - [Define the schema for the input](define-the-schema-for-the-input.md): class InputState(TypedDict): - [Define the schema for the output](define-the-schema-for-the-output.md): class OutputState(TypedDict): - [Define the overall schema, combining both input and output](define-the-overall-schema-combining-both-input-and-output.md): class OverallState(InputState, OutputState): - [Define the node that processes the input and generates an answer](define-the-node-that-processes-the-input-and-generates-an-answer.md): def answer_node(state: InputState): - [Build the graph with input and output schemas specified](build-the-graph-with-input-and-output-schemas-specified.md): builder = StateGraph(OverallState, input_schema=InputState, output_schema=OutputState) - [Invoke the graph with an input and print the result](invoke-the-graph-with-an-input-and-print-the-result.md): print(graph.invoke({"question": "hi"})) - [The overall state of the graph (this is the public state shared across nodes)](the-overall-state-of-the-graph-this-is-the-public-state-shared-across-nodes.md): class OverallState(TypedDict): - [Output from node_1 contains private data that is not part of the overall state](output-from-node-1-contains-private-data-that-is-not-part-of-the-overall-state.md): class Node1Output(TypedDict): - [The private data is only shared between node_1 and node_2](the-private-data-is-only-shared-between-node-1-and-node-2.md): def node_1(state: OverallState) -> Node1Output: - [Node 2 input only requests the private data available after node_1](node-2-input-only-requests-the-private-data-available-after-node-1.md): class Node2Input(TypedDict): - [Node 3 only has access to the overall state (no access to private data from node_1)](node-3-only-has-access-to-the-overall-state-no-access-to-private-data-from-node-.md): def node_3(state: OverallState) -> OverallState: - [node_2 accepts private data from node_1, whereas](node-2-accepts-private-data-from-node-1-whereas.md) - [node_3 does not see the private data.](node-3-does-not-see-the-private-data.md): builder = StateGraph(OverallState).add_sequence([node_1, node_2, node_3]) - [Invoke the graph with the initial state](invoke-the-graph-with-the-initial-state.md): response = graph.invoke( - [The overall state of the graph (this is the public state shared across nodes)](the-overall-state-of-the-graph-this-is-the-public-state-shared-across-nodes-2.md): class OverallState(BaseModel): - [Build the state graph](build-the-state-graph.md): builder = StateGraph(OverallState) - [Test the graph with a valid input](test-the-graph-with-a-valid-input.md): graph.invoke({"a": "hello"}) - [1. Specify config schema](1-specify-config-schema.md): class ContextSchema(TypedDict): - [2. Define a graph that accesses the config in a node](2-define-a-graph-that-accesses-the-config-in-a-node.md): class State(TypedDict): - [3. Pass in configuration at runtime:](3-pass-in-configuration-at-runtime.md): print(graph.invoke({}, context={"my_runtime_value": "a"})) - [Add nodes](add-nodes.md): builder.add_node(step_1) - [Add edges](add-edges.md): builder.add_edge(START, "step_1") - [Add nodes](add-nodes-2.md): builder.add_node(step_1) - [Add edges](add-edges-2.md): builder.add_edge(START, "step_1") - [Call the graph: here we call it to generate a list of jokes](call-the-graph-here-we-call-it-to-generate-a-list-of-jokes.md): for step in graph.stream({"topic": "animals"}): - [Define nodes](define-nodes.md): builder = StateGraph(State) - [Define edges](define-edges.md): def route(state: State) -> Literal["b", END]: - [Define graph state](define-graph-state.md): class State(TypedDict): - [Define the nodes](define-the-nodes.md): def node_a(state: State) -> Command[Literal["node_b", "node_c"]]: - [NOTE: there are no edges between nodes A, B and C!](note-there-are-no-edges-between-nodes-a-b-and-c.md): graph = builder.compile() - [Stream outputs](stream-outputs.md): You can [stream outputs](../concepts/streaming.md) from a LangGraph agent or workflow. - [Use the functional API](use-the-functional-api.md): The [**Functional API**](../concepts/functional_api.md) allows you to add LangGraph's key features — [persistence](..... - [This variable is just used for demonstration purposes to simulate a network failure.](this-variable-is-just-used-for-demonstration-purposes-to-simulate-a-network-fail.md) - [It's not something you will have in your actual code.](its-not-something-you-will-have-in-your-actual-code.md): attempts = 0 - [Let's configure the RetryPolicy to retry on ValueError.](lets-configure-the-retrypolicy-to-retry-on-valueerror.md) - [The default RetryPolicy is optimized for retrying specific network errors.](the-default-retrypolicy-is-optimized-for-retrying-specific-network-errors.md): retry_policy = RetryPolicy(retry_on=ValueError) - [This variable is just used for demonstration purposes to simulate a network failure.](this-variable-is-just-used-for-demonstration-purposes-to-simulate-a-network-fail-2.md) - [It's not something you will have in your actual code.](its-not-something-you-will-have-in-your-actual-code-2.md): attempts = 0 - [Initialize an in-memory checkpointer for persistence](initialize-an-in-memory-checkpointer-for-persistence.md): checkpointer = InMemorySaver() - [Workflow execution configuration with a unique thread identifier](workflow-execution-configuration-with-a-unique-thread-identifier.md): config = { - [This invocation will take ~1 second due to the slow_task execution](this-invocation-will-take-1-second-due-to-the-slow-task-execution.md): try: - [Continue execution](continue-execution.md): for event in graph.stream(Command(resume="baz"), config): - [Use subgraphs](use-subgraphs.md): This guide explains the mechanics of using [subgraphs](../concepts/subgraphs.md). A common application of subgraphs i... - [Subgraph](subgraph.md): def subgraph_node_1(state: State): - [Parent graph](parent-graph.md): builder = StateGraph(State) - [Subgraph](subgraph-2.md): def subgraph_node_1(state: SubgraphState): - [Parent graph](parent-graph-2.md): class State(TypedDict): - [Subgraph](subgraph-3.md): def subgraph_node_1(state: State): - [Parent graph](parent-graph-3.md): builder = StateGraph(State) - [Build multi-agent systems](build-multi-agent-systems.md): A single agent might struggle if it needs to specialize in multiple domains or manage many tools. To tackle this, you... - [Handoffs](handoffs.md): transfer_to_hotel_assistant = create_handoff_tool(agent_name="hotel_assistant") - [Define agents](define-agents.md): flight_assistant = create_react_agent( - [Define multi-agent graph](define-multi-agent-graph.md): multi_agent_graph = ( - [How to pass custom run ID or set tags and metadata for graph runs in LangSmith](how-to-pass-custom-run-id-or-set-tags-and-metadata-for-graph-runs-in-langsmith.md): !!! tip "Prerequisites" - [Generate a random UUID -- it must be a UUID](generate-a-random-uuid-it-must-be-a-uuid.md): config = {"run_id": uuid.uuid4()}, "tags": ["my_tag1"], "metadata": {"a": 5}} - [like invoke, batch, ainvoke, astream_events etc](like-invoke-batch-ainvoke-astream-events-etc.md): graph.stream(inputs, config, stream_mode="values") - [First we initialize the model we want to use.](first-we-initialize-the-model-we-want-to-use.md): model = ChatOpenAI(model="gpt-4o", temperature=0) - [For this tutorial we will use custom tool that returns pre-defined values for weather in two cities (NYC & SF)](for-this-tutorial-we-will-use-custom-tool-that-returns-pre-defined-values-for-we.md): @tool - [Define the graph](define-the-graph.md): graph = create_react_agent(model, tools=tools) - [Call tools](call-tools.md): [Tools](../concepts/tools.md) encapsulate a callable function and its input schema. These can be passed to compatible... - [Invocation example with an agent](invocation-example-with-an-agent.md): agent.invoke( - [Example agent setup](example-agent-setup.md): agent = create_react_agent( - [Invocation: reads the name from state (initially empty)](invocation-reads-the-name-from-state-initially-empty.md): agent.invoke({"messages": "what's my name?"}) - [Default error handling (enabled by default)](default-error-handling-enabled-by-default.md): tool_node = ToolNode([multiply]) - [Default error handling](default-error-handling.md): agent.invoke({"messages": [{"role": "user", "content": "what's 42 x 7?"}]}) - [How to add cross-thread persistence (functional API)](how-to-add-cross-thread-persistence-functional-api.md): !!! info "Prerequisites" - [NOTE: we're passing the store object here when creating a workflow via entrypoint()](note-were-passing-the-store-object-here-when-creating-a-workflow-via-entrypoint.md): @entrypoint(checkpointer=InMemorySaver(), store=in_memory_store) - [How to build a multi-agent network (functional API)](how-to-build-a-multi-agent-network-functional-api.md): !!! info "Prerequisites" - [Define a tool to signal intent to hand off to a different agent](define-a-tool-to-signal-intent-to-hand-off-to-a-different-agent.md): @tool(return_direct=True) - [define an agent](define-an-agent.md): travel_advisor_tools = [transfer_to_hotel_advisor, ...] - [define a task that calls an agent](define-a-task-that-calls-an-agent.md): @task - [define the multi-agent network workflow](define-the-multi-agent-network-workflow.md): @entrypoint() - [Define travel advisor ReAct agent](define-travel-advisor-react-agent.md): travel_advisor_tools = [ - [Define hotel advisor ReAct agent](define-hotel-advisor-react-agent.md): hotel_advisor_tools = [get_hotel_recommendations, transfer_to_travel_advisor] - [How to add multi-turn conversation in a multi-agent application (functional API)](how-to-add-multi-turn-conversation-in-a-multi-agent-application-functional-api.md): !!! info "Prerequisites" - [Define a tool to signal intent to hand off to a different agent](define-a-tool-to-signal-intent-to-hand-off-to-a-different-agent-2.md) - [Note: this is not using Command(goto) syntax for navigating to different agents:](note-this-is-not-using-commandgoto-syntax-for-navigating-to-different-agents.md) - [`workflow()` below handles the handoffs explicitly](workflow-below-handles-the-handoffs-explicitly.md): @tool(return_direct=True) - [define an agent](define-an-agent-2.md): travel_advisor_tools = [transfer_to_hotel_advisor, ...] - [define a task that calls an agent](define-a-task-that-calls-an-agent-2.md): @task - [define the multi-agent network workflow](define-the-multi-agent-network-workflow-2.md): @entrypoint(checkpointer) - [%pip install -U langgraph langchain-anthropic](pip-install-u-langgraph-langchain-anthropic.md): import getpass - [Define travel advisor ReAct agent](define-travel-advisor-react-agent-2.md): travel_advisor_tools = [ - [Define hotel advisor ReAct agent](define-hotel-advisor-react-agent-2.md): hotel_advisor_tools = [get_hotel_recommendations, transfer_to_travel_advisor] - [How to add thread-level persistence (functional API)](how-to-add-thread-level-persistence-functional-api.md): !!! info "Prerequisites" - [How to manage conversation history in a ReAct Agent](how-to-manage-conversation-history-in-a-react-agent.md): !!! info "Prerequisites" - [This function will be added as a new node in ReAct agent graph](this-function-will-be-added-as-a-new-node-in-react-agent-graph.md) - [that will run every time before the node that calls the LLM.](that-will-run-every-time-before-the-node-that-calls-the-llm.md) - [The messages returned by this function will be the input to the LLM.](the-messages-returned-by-this-function-will-be-the-input-to-the-llm.md): def pre_model_hook(state): - [How to integrate LangGraph (functional API) with AutoGen, CrewAI, and other frameworks](how-to-integrate-langgraph-functional-api-with-autogen-crewai-and-other-framewor.md): LangGraph is a framework for building agentic and multi-agent applications. LangGraph can be easily integrated with o... - [add short-term memory for storing conversation history](add-short-term-memory-for-storing-conversation-history.md): checkpointer = InMemorySaver() - [pass the thread ID to persist agent outputs for future interactions](pass-the-thread-id-to-persist-agent-outputs-for-future-interactions-2.md): config = {"configurable": {"thread_id": "1"}} - [filename: fibonacci_range.py](filename-fibonacci-rangepy.md): def fibonacci_sequence(): - [How to handle large numbers of tools](how-to-handle-large-numbers-of-tools.md): This guide assumes familiarity with the following: - [Abbreviated list of S&P 500 companies for demonstration](abbreviated-list-of-sp-500-companies-for-demonstration.md): s_and_p_500_companies = [ - [Create a tool for each company and store it in a registry with a unique UUID as the key](create-a-tool-for-each-company-and-store-it-in-a-registry-with-a-unique-uuid-as-.md): tool_registry = { - [It includes a list of messages (processed by add_messages)](it-includes-a-list-of-messages-processed-by-add-messages.md) - [and a list of selected tool IDs.](and-a-list-of-selected-tool-ids.md): class State(TypedDict): - [Retrieve all available tools from the tool registry.](retrieve-all-available-tools-from-the-tool-registry.md): tools = list(tool_registry.values()) - [by binding selected tools to the LLM.](by-binding-selected-tools-to-the-llm.md): def agent(state: State): - [The select_tools function selects tools based on the user's last message content.](the-select-tools-function-selects-tools-based-on-the-users-last-message-content.md): def select_tools(state: State): - [How to create a ReAct agent from scratch](how-to-create-a-react-agent-from-scratch.md): !!! info "Prerequisites" - [Define our tool node](define-our-tool-node.md): def tool_node(state: AgentState): - [Define the node that calls the model](define-the-node-that-calls-the-model.md): def call_model( - [Define the conditional edge that determines whether to continue or not](define-the-conditional-edge-that-determines-whether-to-continue-or-not.md): def should_continue(state: AgentState): - [Define a new graph](define-a-new-graph.md): workflow = StateGraph(AgentState) - [Define the two nodes we will cycle between](define-the-two-nodes-we-will-cycle-between.md): workflow.add_node("agent", call_model) - [This means that this node is the first one called](this-means-that-this-node-is-the-first-one-called.md): workflow.set_entry_point("agent") - [We now add a conditional edge](we-now-add-a-conditional-edge.md): workflow.add_conditional_edges( - [We now add a normal edge from `tools` to `agent`.](we-now-add-a-normal-edge-from-tools-to-agent.md) - [This means that after `tools` is called, `agent` node is called next.](this-means-that-after-tools-is-called-agent-node-is-called-next.md): workflow.add_edge("tools", "agent") - [Now we can compile and visualize our graph](now-we-can-compile-and-visualize-our-graph.md): graph = workflow.compile() - [Helper function for formatting the stream nicely](helper-function-for-formatting-the-stream-nicely.md): def print_stream(stream): - [How to force tool-calling agent to structure output](how-to-force-tool-calling-agent-to-structure-output.md): This guide assumes familiarity with the following: - [Inherit 'messages' key from MessagesState, which is a list of chat messages](inherit-messages-key-from-messagesstate-which-is-a-list-of-chat-messages.md): class AgentState(MessagesState): - [Force the model to use tools by passing tool_choice="any"](force-the-model-to-use-tools-by-passing-tool-choiceany.md): model_with_response_tool = model.bind_tools(tools, tool_choice="any") - [Define the function that calls the model](define-the-function-that-calls-the-model.md): def call_model(state: AgentState): - [Define the function that responds to the user](define-the-function-that-responds-to-the-user.md): def respond(state: AgentState): - [Define the function that determines whether to continue or not](define-the-function-that-determines-whether-to-continue-or-not.md): def should_continue(state: AgentState): - [Define a new graph](define-a-new-graph-2.md): workflow = StateGraph(AgentState) - [Define the two nodes we will cycle between](define-the-two-nodes-we-will-cycle-between-2.md): workflow.add_node("agent", call_model) - [This means that this node is the first one called](this-means-that-this-node-is-the-first-one-called-2.md): workflow.set_entry_point("agent") - [We now add a conditional edge](we-now-add-a-conditional-edge-2.md): workflow.add_conditional_edges( - [Define the function that calls the model](define-the-function-that-calls-the-model-2.md): def call_model(state: AgentState): - [Define the function that responds to the user](define-the-function-that-responds-to-the-user-2.md): def respond(state: AgentState): - [Define the function that determines whether to continue or not](define-the-function-that-determines-whether-to-continue-or-not-2.md): def should_continue(state: AgentState): - [Define a new graph](define-a-new-graph-3.md): workflow = StateGraph(AgentState) - [Define the two nodes we will cycle between](define-the-two-nodes-we-will-cycle-between-3.md): workflow.add_node("agent", call_model) - [This means that this node is the first one called](this-means-that-this-node-is-the-first-one-called-3.md): workflow.set_entry_point("agent") - [We now add a conditional edge](we-now-add-a-conditional-edge-3.md): workflow.add_conditional_edges( - [How to disable streaming for models that don't support it](how-to-disable-streaming-for-models-that-dont-support-it.md): This guide assumes familiarity with the following: - [How to create a ReAct agent from scratch (Functional API)](how-to-create-a-react-agent-from-scratch-functional-api.md): !!! info "Prerequisites" - [Assistants](assistants.md): **Assistants** allow you to manage configurations (like prompts, LLM selection, tools) separately from your graph's c... - [LangGraph Studio](langgraph-studio.md): !!! info "Prerequisites" - [Double Texting](double-texting.md): !!! info "Prerequisites" - [LangGraph runtime](langgraph-runtime.md): [Pregel](https://langchain-ai.github.io/langgraph/reference/pregel/) implements LangGraph's runtime, managing the exe... - [LangGraph Platform Plans](langgraph-platform-plans.md): LangGraph Platform is a solution for deploying agentic applications in production. - [Template Applications](template-applications.md): Templates are open source reference applications designed to help you get started quickly when building with LangGrap... - [Tools](tools.md): Many AI applications interact with users via natural language. However, some use cases require models to interface di... - [-> AIMessage(tool_calls=[{'name': 'multiply', 'args': {'a': 2, 'b': 3}, ...}])](aimessagetool-callsname-multiply-args-a-2-b-3.md): AIMessage( - [Subgraphs](subgraphs.md): A subgraph is a [graph](./low_level.md#graphs) that is used as a [node](./low_level.md#nodes) in another graph — this... - [Cloud SaaS](cloud-saas.md): To deploy a [LangGraph Server](../concepts/langgraph_server.md), follow the how-to guide for [how to deploy to Cloud ... - [Standalone Container](standalone-container.md): To deploy a [LangGraph Server](../concepts/langgraph_server.md), follow the how-to guide for [how to deploy a Standal... - [Human-in-the-loop](human-in-the-loop.md): To review, edit, and approve tool calls in an agent or workflow, [use LangGraph's human-in-the-loop features](../how-... - [MCP endpoint in LangGraph Server](mcp-endpoint-in-langgraph-server.md): The [Model Context Protocol (MCP)](./mcp.md) is an open protocol for describing tools and data sources in a model-agn... - [Define input schema](define-input-schema.md): class InputState(TypedDict): - [Define output schema](define-output-schema.md): class OutputState(TypedDict): - [Combine input and output](combine-input-and-output.md): class OverallState(InputState, OutputState): - [Define the processing node](define-the-processing-node.md): def answer_node(state: InputState): - [Build the graph with explicit schemas](build-the-graph-with-explicit-schemas.md): builder = StateGraph(OverallState, input_schema=InputState, output_schema=OutputState) - [Run the graph](run-the-graph.md): print(graph.invoke({"question": "hi"})) - [Create server parameters for stdio connection](create-server-parameters-for-stdio-connection.md): from mcp import ClientSession - [Self-Hosted Data Plane](self-hosted-data-plane.md): There are two versions of the self-hosted deployment: [Self-Hosted Data Plane](./deployment_options.md#self-hosted-da... - [Streaming](streaming.md): LangGraph implements a streaming system to surface real-time updates, allowing for responsive and transparent user ex... - [Functional API concepts](functional-api-concepts.md): The **Functional API** allows you to add LangGraph's key features — [persistence](./persistence.md), [memory](../how-... - [Deployment Options](deployment-options.md): [Local](../tutorials/langgraph-platform/local-server.md): Deploy for local testing and development. - [LangGraph SDK](langgraph-sdk.md): LangGraph Platform provides a python SDK for interacting with [LangGraph Server](./langgraph_server.md). - [LangGraph Server](langgraph-server.md): **LangGraph Server** offers an API for creating and managing agent-based applications. It is built on the concept of ... - [LangGraph Platform](langgraph-platform.md): Develop, deploy, scale, and manage agents with **LangGraph Platform** — the purpose-built platform for long-running, ... - [Tracing](tracing.md): Traces are a series of steps that your application takes to go from input to output. Each of these individual steps i... - [Memory](memory.md): [Memory](../how-tos/memory/add-memory.md) is a system that remembers information about previous interactions. For AI ... - [Node that *uses* the instructions](node-that-uses-the-instructions.md): def call_model(state: State, store: BaseStore): - [Node that updates instructions](node-that-updates-instructions.md): def update_instructions(state: State, store: BaseStore): - [InMemoryStore saves data to an in-memory dictionary. Use a DB-backed store in production use.](inmemorystore-saves-data-to-an-in-memory-dictionary-use-a-db-backed-store-in-pro.md): store = InMemoryStore(index={"embed": embed, "dims": 2}) - [get the "memory" by ID](get-the-memory-by-id.md): item = store.get(namespace, "a-memory") - [search for "memories" within this namespace, filtering on content equivalence, sorted by vector similarity](search-for-memories-within-this-namespace-filtering-on-content-equivalence-sorte.md): items = store.search( - [Agent architectures](agent-architectures.md): Many LLM applications implement a particular control flow of steps before and / or after LLM calls. As an example, [R... - [Authentication & Access Control](authentication-access-control.md): LangGraph Platform provides a flexible authentication and authorization system that can integrate with most authentic... - [Generic / global handler catches calls that aren't handled by more specific handlers](generic-global-handler-catches-calls-that-arent-handled-by-more-specific-handler.md): @auth.on - [Matches the "thread" resource and all actions - create, read, update, delete, search](matches-the-thread-resource-and-all-actions-create-read-update-delete-search.md) - [Since this is **more specific** than the generic @auth.on handler, it will take precedence](since-this-is-more-specific-than-the-generic-authon-handler-it-will-take-precede.md) - [over the generic handler for all actions on the "threads" resource](over-the-generic-handler-for-all-actions-on-the-threads-resource.md): @auth.on.threads - [Thread creation. This will match only on thread create actions](thread-creation-this-will-match-only-on-thread-create-actions.md) - [Since this is **more specific** than both the generic @auth.on handler and the @auth.on.threads handler,](since-this-is-more-specific-than-both-the-generic-authon-handler-and-the-authont.md) - [it will take precedence for any "create" actions on the "threads" resources](it-will-take-precedence-for-any-create-actions-on-the-threads-resources.md): @auth.on.threads.create - [Reading a thread. Since this is also more specific than the generic @auth.on handler, and the @auth.on.threads handler,](reading-a-thread-since-this-is-also-more-specific-than-the-generic-authon-handle.md) - [it will take precedence for any "read" actions on the "threads" resource](it-will-take-precedence-for-any-read-actions-on-the-threads-resource.md): @auth.on.threads.read - [This takes precedenceover the generic @auth.on handler and the @auth.on.threads handler](this-takes-precedenceover-the-generic-authon-handler-and-the-authonthreads-handl.md): @auth.on.threads.create_run - [Assistant creation](assistant-creation.md): @auth.on.assistants.create - [In your auth handler:](in-your-auth-handler.md): @auth.authenticate - [FAQ](faq.md): Common questions and their answers! - [MCP](mcp.md): [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is an open protocol that standardizes ho... - [Multi-agent systems](multi-agent-systems.md): An [agent](./agentic_concepts.md#agent-architectures) is _a system that uses an LLM to decide the control flow of an ... - [this is the agent function that will be called as tool](this-is-the-agent-function-that-will-be-called-as-tool.md) - [notice that you can pass the state to the tool via InjectedState annotation](notice-that-you-can-pass-the-state-to-the-tool-via-injectedstate-annotation.md): def agent_1(state: Annotated[dict, InjectedState]): - [the simplest way to build a supervisor w/ tool-calling is to use prebuilt ReAct agent graph](the-simplest-way-to-build-a-supervisor-w-tool-calling-is-to-use-prebuilt-react-a.md) - [that consists of a tool-calling LLM node (i.e. supervisor) and a tool-executing node](that-consists-of-a-tool-calling-llm-node-ie-supervisor-and-a-tool-executing-node.md): supervisor = create_react_agent(model, tools) - [define team 1 (same as the single supervisor example above)](define-team-1-same-as-the-single-supervisor-example-above.md): def team_1_supervisor(state: MessagesState) -> Command[Literal["team_1_agent_1", "team_1_agent_2", END]]: - [define team 2 (same as the single supervisor example above)](define-team-2-same-as-the-single-supervisor-example-above.md): class Team2State(MessagesState): - [define top-level supervisor](define-top-level-supervisor.md): builder = StateGraph(MessagesState) - [define the flow explicitly](define-the-flow-explicitly.md): builder.add_edge(START, "agent_1") - [Scalability & Resilience](scalability-resilience.md): LangGraph Platform is designed to scale horizontally with your workload. Each instance of the service is stateless, a... - [Graph API concepts](graph-api-concepts.md): At its core, LangGraph models agent workflows as graphs. You define the behavior of your agents using three key compo... - [{'graph_output': 'My name is Lance'}](graph-output-my-name-is-lance.md): There are two subtle and important points to note here: - [this is supported](this-is-supported.md): {"messages": [HumanMessage(content="message")]} - [and this is also supported](and-this-is-also-supported.md): {"messages": [{"type": "human", "content": "message"}]} - [You can then create edges to/from this node by referencing it as `"my_node"`](you-can-then-create-edges-tofrom-this-node-by-referencing-it-as-my-node.md): The`START`Node is a special node that represents the node that sends user input to the graph. The main purpose for ... - [LangGraph Control Plane](langgraph-control-plane.md): The term "control plane" is used broadly to refer to the control plane UI where users create and update [LangGraph Se... - [Durable Execution](durable-execution.md): **Durable execution** is a technique in which a process or workflow saves its progress at key points, allowing it to ... - [LangGraph Data Plane](langgraph-data-plane.md): The term "data plane" is used broadly to refer to [LangGraph Servers](./langgraph_server.md) (deployments), the corre... - [Overview](overview.md): LangGraph is built for developers who want to build powerful, adaptable AI agents. Developers choose LangGraph for: - [Self-Hosted Control Plane](self-hosted-control-plane.md): There are two versions of the self-hosted deployment: [Self-Hosted Data Plane](./deployment_options.md#self-hosted-da... - [LangGraph CLI](langgraph-cli.md): **LangGraph CLI** is a multi-platform command-line tool for building and running the [LangGraph API server](./langgra... - [Persistence](persistence.md): LangGraph has a built-in persistence layer, implemented through checkpointers. When you compile a graph with a checkp... - [get the latest state snapshot](get-the-latest-state-snapshot.md): config = {"configurable": {"thread_id": "1"}} - [get a state snapshot for a specific checkpoint_id](get-a-state-snapshot-for-a-specific-checkpoint-id.md): config = {"configurable": {"thread_id": "1", "checkpoint_id": "1ef663ba-28fe-6528-8002-5a559208592c"}} - [(This can be done after putting memories into the store)](this-can-be-done-after-putting-memories-into-the-store.md): memories = store.search( - [Store with specific fields to embed](store-with-specific-fields-to-embed.md): store.put( - [Store without embedding (still retrievable, but not searchable)](store-without-embedding-still-retrievable-but-not-searchable.md): store.put( - [We need this because we want to enable threads (conversations)](we-need-this-because-we-want-to-enable-threads-conversations.md): checkpointer = InMemorySaver() - [Compile the graph with the checkpointer and store](compile-the-graph-with-the-checkpointer-and-store.md): graph = graph.compile(checkpointer=checkpointer, store=in_memory_store) - [Invoke the graph](invoke-the-graph-3.md): user_id = "1" - [First let's just say hi to the AI](first-lets-just-say-hi-to-the-ai.md): for update in graph.stream( - [Invoke the graph](invoke-the-graph-4.md): config = {"configurable": {"thread_id": "2", "user_id": "1"}} - [Let's say hi again](lets-say-hi-again.md): for update in graph.stream( - [... Define the graph ...](define-the-graph-2.md): graph.compile( - [Application Structure](application-structure.md): A LangGraph application consists of one or more graphs, a configuration file (`langgraph.json`), a file that specifie... - [Time Travel ⏱️](time-travel.md): When working with non-deterministic systems that make model-based decisions (e.g., agents powered by LLMs), it can be...