Ephemeral Value Channel (channels/ephemeral_value.py)

langgraph · libs/langgraph/langgraph/channels/ephemeral_value.py · python · MIT
automation, fw:langgraph, tag:channel, tag:ephemeral, tag:state

Stores the value from the previous step and clears after use, providing temporary state in workflows.

# Source: https://github.com/langchain-ai/langgraph | License: MIT | Copyright 2024 LangChain, Inc
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations

from collections.abc import Sequence
from typing import Any, Generic

from typing_extensions import Self

from langgraph._internal._typing import MISSING
from langgraph.channels.base import BaseChannel, Value
from langgraph.errors import EmptyChannelError, InvalidUpdateError

__all__ = ("EphemeralValue",)


class EphemeralValue(Generic[Value], BaseChannel[Value, Value, Value]):
    """Stores the value received in the step immediately preceding, clears after."""

    __slots__ = ("value", "guard")

    value: Value | Any
    guard: bool

    def __init__(self, typ: Any, guard: bool = True) -> No

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key