Home / Class/ Node Class — langchain Architecture

Node Class — langchain Architecture

Architecture documentation for the Node class in graph.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ab6bc67d_beba_4c36_aefe_bf6dbf00f696["Node"]
  81a6280b_4752_84db_f1fa_1a3b8040d481["graph.py"]
  ab6bc67d_beba_4c36_aefe_bf6dbf00f696 -->|defined in| 81a6280b_4752_84db_f1fa_1a3b8040d481
  3db09069_0f77_1402_7f96_14d549abbd03["copy()"]
  ab6bc67d_beba_4c36_aefe_bf6dbf00f696 -->|method| 3db09069_0f77_1402_7f96_14d549abbd03

Relationship Graph

Source Code

libs/core/langchain_core/runnables/graph.py lines 93–125

class Node(NamedTuple):
    """Node in a graph."""

    id: str
    """The unique identifier of the node."""
    name: str
    """The name of the node."""
    data: type[BaseModel] | RunnableType | None
    """The data of the node."""
    metadata: dict[str, Any] | None
    """Optional metadata for the node. """

    def copy(
        self,
        *,
        id: str | None = None,
        name: str | None = None,
    ) -> Node:
        """Return a copy of the node with optional new id and name.

        Args:
            id: The new node id.
            name: The new node name.

        Returns:
            A copy of the node with the new id and name.
        """
        return Node(
            id=id or self.id,
            name=name or self.name,
            data=self.data,
            metadata=self.metadata,
        )

Frequently Asked Questions

What is the Node class?
Node is a class in the langchain codebase, defined in libs/core/langchain_core/runnables/graph.py.
Where is Node defined?
Node is defined in libs/core/langchain_core/runnables/graph.py at line 93.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free