Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
state.cpython-313.pyc829 linesDownload Raw Back to __pycache__
1�

2��j'�3��SSKJr SSKrSSKrSSKrSSKrSSKJr SSKJ	r	J4r5JrJr SSK
JrJr SSKJr SSKJr SSKJrJrJrJr SS	KJr SS6KJr SSKJrJrJrJrJrJ r J!r!J"r"J#r#J$r$ SSK%J&r&J'r' SS
K(J)r) SSK*J+r+ SSK,J-r- SSK.J/r/J0r0 SSK1J2r2J3r3J4r4J5r5J6r6 SSK7J8r8 SSK9J:r:J;r;J<r<J=r= SSK>J?r?J@r@JArA SSKBJCrC SSKDJErE SSKFJGrG SSKHJIrIJJrJJKrK SSKLJMrM SSKNJOrO SSKPJQrQ SSKRJSrS SSKTJUrUJVrV SSKWJXrXJYrY SSKZJ[r[J\r\J]r] SS K^J_r_J`r`JaraJbrb SS!KcJdrd SS"KeJfrfJgrg SS#KhJiriJjrj SS$KkJlrl SS%KmJnrnJoro SS&KpJqrqJrrrJsrs SS'KtJuruJvrvJwrwJxrxJyryJzrzJ{r{J|r| SS(K}J~r~JrJ�r�J�r�J�r� SS)K�J�r�J�r� S*r�\GR"\�5r�S+r�S,r�\"S-S.9"S/S055r�SFS1jr�SGS2jr�"S3S4\\�\~\\�45r�"S5S6\l\�\~\\�4\\�\~\\�45r�SHS7jr�\"S85r�SIS9jr�SJS:jr�SKS;jr�SLS<jr�SMS=jr�\$SNS>j5r�\$S-S?.SOS@jj5r�S-S?.SPSAjjr�SQSBjr�SRSCjr�SSSDjr�STSEjr�g)U�)�annotationsN)�defaultdict)�	Awaitable�Callable�Hashable�Sequence)�	dataclass�is_dataclass)�	timedelta)�partial)�isclass�7isfunction�ismethod�	signature)�FunctionType)�NoneType)8�Any�Generic�Literal�TypeVar�Union�cast�get_args�9get_origin�get_type_hints�overload)�Runnable�RunnableConfig)�	BaseCache)�10Checkpoint)�	BaseStore)�	BaseModel�TypeAdapter)�NotRequired�Required�Self�Unpack�is_typeddict)�_serde)�	INTERRUPT�NS_END�NS_SEP�TASKS)�get_cached_annotated_keys�get_field_default�get_update_as_tuples)�create_model)�coerce_to_runnable)�coerce_timeout_policy)�	EMPTY_SEQ�MISSING�DeprecatedKwargs)�BaseChannel)�BinaryOperatorAggregate)�DeltaChannel)�EphemeralValue)�	LastValue�LastValueAfterFinish)�NamedBarrierValue�NamedBarrierValueAfterFinish)�END�START�11TAG_HIDDEN)�	ErrorCode�InvalidUpdateError�
ParentCommand�create_error_message)�12BranchSpec)�	StateNode�
StateNodeSpec)�ManagedValueSpec�is_managed_value)�Pregel)�ChannelRead�13PregelNode)�ChannelWrite�ChannelWriteEntry�ChannelWriteTupleEntry)�All�CachePolicy�Checkpointer�Command�RetryPolicy�Send�
TimeoutPolicy�ensure_valid_checkpointer)�ContextT�InputT�14NodeInputT�OutputT�StateT)�LangGraphDeprecatedSinceV05�LangGraphDeprecatedSinceV10)�15StateGraph�CompiledStateGraphzbranch:to:{}�__default_error_handler__T)�slotsc�R�\rSrSr%SrSrS\S'SrS\S'SrS\S	'Sr	S16\S'Sr17g)
�
_NodeDefaults�ez<Default node policies applied to every node at compile time.N�*RetryPolicy | Sequence[RetryPolicy] | None�retry_policy�CachePolicy | None�cache_policyzStateNode[Any, Any] | None�
error_handlerzTimeoutPolicy | None�timeout�)�__name__�18__module__�__qualname__�__firstlineno__�__doc__rh�__annotations__rjrkrl�__static_attributes__rm��[D:\code\apps\devtools\python\user_packages\Python313\site-packages\langgraph/graph/state.pyrerees1��F�?C�L�<�C�'+�L�$�+�04�M�-�4�$(�G�
!�(rurec��[U[5(ag[R"U5(ag[R19"SUS35 g)NzInvalid state_schema: z�. Expected a type or Annotated[type, reducer]. Please provide a valid schema to ensure correct updates.20 See: https://langchain-ai.github.io/langgraph/reference/graphs/#stategraph)�21isinstance�type�typingr�warnings�warn)�schemas rv�_warn_invalid_state_schemar~osC���&�$����
���v�����M�M�22 ���)V�	V�ruc��[USURR5$![a [	S[U535ef=f)NrnzUnsupported node type: )�getattr�	__class__rn�AttributeError�	TypeErrorry)�nodes rv�_get_node_namer�{sI��@��t�Z����)@�)@�A�A���@��1�$�t�*��>�?�?�@�s	� #�"Ac23�x�\rSrSr%SrS\S'S\S'S\S'S	\S24'S\S'S
\S'S\S'S\S'S\S'S\S'S\S'S\S'S4SSS.S5SjjjrSSSSS.S6Sjjr\S7S j5r	S8S9S!jjr25\S"SSSSSSSS#.S:S$jj5r\S"SSSSSSS%.S;S&jj5r\S"SSSSSSSS#.S<S'jj5r\S4S"SSSSSSS%.S=S(jjj5rS4S"SSSSSSSS#.S>S)jjjrS?S*jr
S4S@S+jjrSAS,jrSBS-jrS4SCS.jjrSBS/jrS4SDS0jjrS4SSSSS"SSS1.SES2jjjrS3rg)Fr`�a�A graph whose nodes communicate by reading and writing to a shared state.26 27The signature of each node is `State -> Partial<State>`.28 29Each state key can optionally be annotated with a reducer function that30will be used to aggregate the values of that key received from multiple nodes.31The signature of a reducer function is `(Value, Value) -> Value`.32 33!!! warning34 35    `StateGraph` is a builder class and cannot be used directly for execution.36    You must first call `.compile()` to create an executable graph that supports37    methods like `invoke()`, `stream()`, `astream()`, and `ainvoke()`. See the38    `CompiledStateGraph` documentation for more details.39 40Args:41    state_schema: The schema class that defines the state.42    context_schema: The schema class that defines the runtime context.43 44        Use this to expose immutable context data to your nodes, like `user_id`, `db_conn`, etc.45    input_schema: The schema class that defines the input to the graph.46    output_schema: The schema class that defines the output from the graph.47 48!!! warning "`config_schema` Deprecated"49    The `config_schema` parameter is deprecated in v0.6.0 and support will be removed in v2.0.0.50    Please use `context_schema` instead to specify the schema for run-scoped context.51 52Example:53    ```python54    from langchain_core.runnables import RunnableConfig55    from typing_extensions import Annotated, TypedDict56    from langgraph.checkpoint.memory import InMemorySaver57    from langgraph.graph import StateGraph58    from langgraph.runtime import Runtime59 60 61    def reducer(a: list, b: int | None) -> list:62        if b is not None:63            return a + [b]64        return a65 66 67    class State(TypedDict):68        x: Annotated[list, reducer]69 70 71    class Context(TypedDict):72        r: float73 74 75    graph = StateGraph(state_schema=State, context_schema=Context)76 77 78    def node(state: State, runtime: Runtime[Context]) -> dict:79        r = runtime.context.get("r", 1.0)80        x = state["x"][-1]81        next_value = x * r * (1 - x)82        return {"x": next_value}83 84 85    graph.add_node("A", node)86    graph.set_entry_point("A")87    graph.set_finish_point("A")88    compiled = graph.compile()89 90    step1 = compiled.invoke({"x": 0.5}, context={"r": 3.0})91    # {'x': [0.5, 0.75]}92    ```93�set[tuple[str, str]]�edgesz'dict[str, StateNodeSpec[Any, ContextT]]�nodesz'defaultdict[str, dict[str, BranchSpec]]�brancheszdict[str, BaseChannel]�channelszdict[str, ManagedValueSpec]�managedz:dict[type[Any], dict[str, BaseChannel | ManagedValueSpec]]�schemasz set[tuple[tuple[str, ...], str]]�
waiting_edges�bool�compiled�type[StateT]�state_schema�type[ContextT] | None�context_schemaztype[InputT]�input_schemaz
type[OutputT]�
output_schemaN)r�r�c��URS[5=n[La4[R"S[SS9 Uc[[[U5nURS[5=n[La4[R"S[SS9 Uc[[[U5nURS[5=n[La4[R"S[SS9 Uc[[[U5n0Ul[5Ul
[[5Ul0Ul0Ul0UlS	Ul[5UlXl[[[U=(d U5Ul[[[U=(d U5UlX l[55UlUR9UR,5 UR9UR.S	S949 UR9UR0S	S959 g)N�
config_schemazW`config_schema` is deprecated and will be removed. Please use `context_schema` instead.�)�category�96stacklevel�input�M`input` is deprecated and will be removed. Please use `input_schema` instead.�outputzO`output` is deprecated and will be removed. Please use `output_schema` instead.F��
allow_managed)�getr5r{r|r_rryrYr^rZr\r��setr�r�dictr�r�r�r�r�r�r�r�r�r�re�_node_defaults�_add_schema)	�selfr�r�r�r��kwargsr��input_r�s	         rv�__init__�StateGraph.__init__�s���$�Z�Z���A�A�M�'�Q��M�M�i�4��
�97�%�!%�d�8�n�m�!D���j�j��'�2�2�F�7�B��M�M�_�4��
�98�#�#�D��L�&�9���j�j��7�3�3�F�G�C��M�M�a�4��
�99�$� $�T�'�]�F� ;�
���100��U��101�#�D�)��
������
������
� �U���(�� ��f��|�/K�|�L���!�$�w�-��1N�,�O���,��-:�_�������*�*�+�����*�*�%��@�����+�+�5��Aru)rhrjrkrlc�z�URnUbXlUbX%lUbX5lUb[	U5UlU$)a
Set default node policies that apply to every node in this graph.102 103Per-node values passed to `add_node` always take precedence over these104defaults. Defaults are applied at `compile()` time. Policies set here105are **not** inherited by subgraphs.106 107`retry_policy` and `timeout` defaults apply to **all** nodes,108including error-handler nodes. `cache_policy` and `error_handler`109defaults only apply to regular nodes -- caching error-handler results110is unsafe, and handlers must never catch themselves.111 112Args:113    retry_policy: Default retry policy for nodes that don't specify114        their own via `add_node(..., retry_policy=...)`. Also applies115        to error-handler nodes.116    cache_policy: Default cache policy for nodes that don't specify117        their own via `add_node(..., cache_policy=...)`. Does **not**118        apply to error-handler nodes.119    error_handler: Default error handler invoked when any regular node120        raises and does not have its own `error_handler` set via121        `add_node`. The handler is **not** invoked when an122        error-handler node itself raises -- handler failures fail the123        run.124    timeout: Default timeout policy for nodes that don't specify their125        own via `add_node(..., timeout=...)`. Also applies to126        error-handler nodes. Accepts a `TimeoutPolicy`, a number of127        seconds (`float`), or a `timedelta`.128 129Returns:130    Self: The builder instance, for chaining.131 132Example:133    ```python134    graph = (135        StateGraph(State)136        .set_node_defaults(137            retry_policy=RetryPolicy(max_attempts=3),138            error_handler=my_fallback_handler,139        )140        .add_node("a", node_a)141        .add_node("b", node_b, retry_policy=custom_retry)  # overrides default142        .add_edge(START, "a")143        .compile()144    )145    ```146)r�rhrjrkr3rl)r�rhrjrkrl�defaultss      rv�set_node_defaults�StateGraph.set_node_defaultssL��l�&�&���#�$0�!��#�$0�!��$�%2�"���4�W�=�H���ruc	��URURVVVs1sHupUHo3U4iM M snnn-$s snnnf�N)r�r�)r��starts�end�starts    rv�147_all_edges�StateGraph._all_edgesPsB���z�z�,0�,>�,>�148�,>�[�V�F�5�C�L�F�L�,>�149�150�	151��152s�<153c��XR;Ga6[U5 [U5up4nU(a7U(d0SRU5n[	USS5n[SUSUS35e0UEUEURU'UR
5H]up�X�R;a;URUU	:wa&[U	[5(aM>[SUS35eMOX�RU'M_ UR
5HFup�X�R;a$URUU:wa[S	US35eM8X@RU'MH gg)154Nz, rn�z%Invalid managed channels detected in z: z<. Managed channels are not permitted in Input/Output schema.z	Channel 'z&' already exists with a different typezManaged value ')r�r~�
_get_channels�joinr��155ValueError�itemsr�rxr;r�)156r�r}r�r�r��157type_hints�names�schema_name�key�channels158          rvr��StateGraph._add_schemaVsQ�����%�&�v�.�,9�&�,A�)�H�z��}��	�	�'�*��%�f�j�"�=�� �;�K�=��5�'�RR�R���$;�h�#:�'�#:�D�L�L�� � (��� 0����-�-�'��}�}�S�)�W�4�%�g�y�9�9� �",�"+�C�5�0V� W�#��	5�*1�M�M�#�&�!1�!(�
�
�����,�,�&��|�|�C�(�G�3�(�-�c�U�2X�Y���4�159)0�L�L��%�!0�-&ruF)�defer�metadatar�rhrjrk�destinationsrlc��g)a�Add a new node to the `StateGraph`, input schema is inferred as the state schema.160 161Will take the name of the function/runnable as the node name.162 163Args:164    node: The function or runnable this node will run.165    defer: Whether to defer the execution of the node until the run is about to end.166    metadata: The metadata associated with the node.167    input_schema: The input schema for the node. (Default: the graph's state schema)168    retry_policy: The retry policy for the node.169 170        If a sequence is provided, the first matching policy will be applied.171    cache_policy: The cache policy for the node.172    destinations: Destinations that indicate where a node can route to.173 174        Useful for edgeless graphs with nodes that return `Command` objects.175 176        If a `dict` is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.177 178        If a `tuple` is provided, the values will be used as the target node names.179 180        !!! warning181 182            This is only used for graph rendering and doesn't have any effect on the graph execution.183 184Example:185    ```python186    from typing_extensions import TypedDict187 188    from langchain_core.runnables import RunnableConfig189    from langgraph.graph import START, StateGraph190 191 192    class State(TypedDict):193        x: int194 195 196    def my_node(state: State, config: RunnableConfig) -> State:197        return {"x": state["x"] + 1}198 199 200    builder = StateGraph(State)201    builder.add_node(my_node)  # node name will be 'my_node'202    builder.add_edge(START, "my_node")203    graph = builder.compile()204    graph.invoke({"x": 1})205    # {'x': 2}206    ```207 208Returns:209    Self: The instance of the `StateGraph`, allowing for method chaining.210Nrm�r�r�r�r�r�rhrjrkr�rlr�s           rv�add_node�StateGraph.add_nodev���F	ru)r�r�rhrjrkr�rlc��g)a�Add a new node to the `StateGraph` where input schema is specified.211 212Will take the name of the function/runnable as the node name.213 214Args:215    node: The function or runnable this node will run.216    defer: Whether to defer the execution of the node until the run is about to end.217    metadata: The metadata associated with the node.218    input_schema: The input schema for the node.219    retry_policy: The retry policy for the node.220 221        If a sequence is provided, the first matching policy will be applied.222    cache_policy: The cache policy for the node.223    destinations: Destinations that indicate where a node can route to.224 225        Useful for edgeless graphs with nodes that return `Command` objects.226 227        If a `dict` is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.228 229        If a `tuple` is provided, the values will be used as the target node names.230 231        !!! warning232 233            This is only used for graph rendering and doesn't have any effect on the graph execution.234 235Example:236    ```python237    from typing_extensions import TypedDict238 239    from langchain_core.runnables import RunnableConfig240    from langgraph.graph import START, StateGraph241 242 243    class State(TypedDict):244        x: int245 246 247    class NodeInput(TypedDict):248        x: int249 250 251    def my_node(state: NodeInput, config: RunnableConfig) -> State:252        return {"x": state["x"] + 1}253 254 255    builder = StateGraph(State)256    builder.add_node(my_node, input_schema=NodeInput)  # node name will be 'my_node'257    builder.add_edge(START, "my_node")258    graph = builder.compile()259    graph.invoke({"x": 1})260    # {'x': 2}261    ```262 263Returns:264    Self: The instance of the `StateGraph`, allowing for method chaining.265Nrmr�s           rvr�r��s��N	ruc��g)a�Add a new node to the `StateGraph`, input schema is inferred as the state schema.266 267Args:268    node: The name of the node.269    action: The function or runnable this node will run.270    defer: Whether to defer the execution of the node until the run is about to end.271    metadata: The metadata associated with the node.272    input_schema: The input schema for the node. (Default: the graph's state schema)273    retry_policy: The retry policy for the node.274 275        If a sequence is provided, the first matching policy will be applied.276    cache_policy: The cache policy for the node.277    destinations: Destinations that indicate where a node can route to.278 279        Useful for edgeless graphs with nodes that return `Command` objects.280 281        If a `dict` is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.282 283        If a `tuple` is provided, the values will be used as the target node names.284 285        !!! warning286 287            This is only used for graph rendering and doesn't have any effect on the graph execution.288 289Example:290    ```python291    from typing_extensions import TypedDict292 293    from langchain_core.runnables import RunnableConfig294    from langgraph.graph import START, StateGraph295 296 297    class State(TypedDict):298        x: int299 300 301    def my_node(state: State, config: RunnableConfig) -> State:302        return {"x": state["x"] + 1}303 304 305    builder = StateGraph(State)306    builder.add_node("my_fair_node", my_node)307    builder.add_edge(START, "my_fair_node")308    graph = builder.compile()309    graph.invoke({"x": 1})310    # {'x': 2}311    ```312 313Returns:314    Self: The instance of the `StateGraph`, allowing for method chaining.315Nrm�r�r��actionr�r�r�rhrjrkr�rlr�s            rvr�r�r�ruc��g)a�Add a new node to the `StateGraph`, input schema is specified.316 317Args:318    node: The function or runnable this node will run.319 320        If a string is provided, it will be used as the node name, and action will be used as the function or runnable.321    action: The action associated with the node.322 323        Will be used as the node function or runnable if `node` is a string (node name).324    defer: Whether to defer the execution of the node until the run is about to end.325    metadata: The metadata associated with the node.326    input_schema: The input schema for the node.327    retry_policy: The retry policy for the node.328 329        If a sequence is provided, the first matching policy will be applied.330    cache_policy: The cache policy for the node.331    destinations: Destinations that indicate where a node can route to.332 333        Useful for edgeless graphs with nodes that return `Command` objects.334 335        If a `dict` is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.336 337        If a `tuple` is provided, the values will be used as the target node names.338 339        !!! warning340 341            This is only used for graph rendering and doesn't have any effect on the graph execution.342 343Example:344    ```python345    from typing_extensions import TypedDict346 347    from langchain_core.runnables import RunnableConfig348    from langgraph.graph import START, StateGraph349 350 351    class State(TypedDict):352        x: int353 354 355    class NodeInput(TypedDict):356        x: int357 358 359    def my_node(state: NodeInput, config: RunnableConfig) -> State:360        return {"x": state["x"] + 1}361 362 363    builder = StateGraph(State)364    builder.add_node("my_fair_node", my_node, input_schema=NodeInput)365    builder.add_edge(START, "my_fair_node")366    graph = builder.compile()367    graph.invoke({"x": 1})368    # {'x': 2}369    ```370 371Returns:372    Self: The instance of the `StateGraph`, allowing for method chaining.373Nrmr�s            rvr�r�Is��V	ruc��	�URS[5=n[La[R"S[S9 UcUnURS[5=n
[La6[R"S[S9 Uc[[[S-U
5n[U3745n375[U[5(dWUn[U[5(aUR5nO![USURR5nUc[!S5eUR"(a[$R'S	5 [U[5(d6Un[[[US376[USS555nUc[!S5eUc[(eXR*;a[!SUS35eU[,:Xd377U[.:Xa[!SUS
35e[0[24HnX�;dM378[!SUS35e Sn[4n[7U5(d,[9U5(d[9[USS55(Ga`[;[US55=(d [;U5=n(Ga1Uc�[=[?[@RB"[[DU55RFRI555nURU5=n(a'[U[5(a[;U5(aUnURS5=n(a�[KU5nU[LLa.[OU5nUHn[KU5nU[PLdMUnUn O U[PLa>[OU5=n(a,[KUS5[RLa[OUS5=n(aUnU	bU	nU=(d U=(d URZnSnUbVSU3nUUR*;a[!SUS35e[\[^[`4"[cUUSS9SUSSSS9UR*U'Ub5[\[[`4"[cX!SS9UUUUUUUU379S9	UR*U'OhUb'[][cX!SS9UUUUUUUU380S9	UR*U'O>[\[d[`4"[cX!SS9UURZUUUUUU381S9	UR*U'U=(d UnUbURgU5 U$![T[V[X4a GNWf=f)a�382Add a new node to the `StateGraph`.383 384Args:385    node: The function or runnable this node will run.386 387        If a string is provided, it will be used as the node name, and action will be used as the function or runnable.388    action: The action associated with the node.389 390        Will be used as the node function or runnable if `node` is a string (node name).391    defer: Whether to defer the execution of the node until the run is about to end.392    metadata: The metadata associated with the node.393    input_schema: The input schema for the node. (Default: the graph's state schema)394    retry_policy: The retry policy for the node.395 396        If a sequence is provided, the first matching policy will be applied.397    cache_policy: The cache policy for the node.398    error_handler: Optional node-level error handler callable for this node.399    destinations: Destinations that indicate where a node can route to.400 401        Useful for edgeless graphs with nodes that return `Command` objects.402 403        If a `dict` is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.404 405        If a `tuple` is provided, the values will be used as the target node names.406 407        !!! warning408 409            This is only used for graph rendering and doesn't have any effect on the graph execution.410    timeout: Timeout for each node attempt. A number or `timedelta` is411        a hard wall-clock cap and is not refreshed. Use `TimeoutPolicy`412        to configure both a wall-clock `run_timeout` and an413        `idle_timeout` refreshed by progress signals. When exceeded, a414        [`NodeTimeoutError`][langgraph.errors.NodeTimeoutError] is raised415        and the retry policy (if any) decides whether to retry. Timeouts416        are supported only for async nodes; sync nodes cannot be safely417        cancelled in-process.418 419Example:420    ```python421    from typing_extensions import TypedDict422 423    from langchain_core.runnables import RunnableConfig424    from langgraph.graph import START, StateGraph425 426 427    class State(TypedDict):428        x: int429 430 431    def my_node(state: State, config: RunnableConfig) -> State:432        return {"x": state["x"] + 1}433 434 435    builder = StateGraph(State)436    builder.add_node(my_node)  # node name will be 'my_node'437    builder.add_edge(START, "my_node")438    graph = builder.compile()439    graph.invoke({"x": 1})440    # {'x': 2}441    ```442 443Example: Customize the name:444    ```python445    builder = StateGraph(State)446    builder.add_node("my_fair_node", my_node)447    builder.add_edge(START, "my_fair_node")448    graph = builder.compile()449    graph.invoke({"x": 1})450    # {'x': 2}451    ```452 453Returns:454    Self: The instance of the `StateGraph`, allowing for method chaining.455�retryzM`retry` is deprecated and will be removed. Please use `retry_policy` instead.)r�Nr�r�rnz6Node name must be provided if action is not a functionzjAdding a node to a graph that has already been compiled. This will not be reflected in the compiled graph.�namezNode `z` already present.z` is reserved.�'z?' is a reserved character and is not allowed in the node names.�__call__�returnr�__error_handler__z#Auto-generated error handler node `�` already exists.F�r��traceT�r�r�rhrj�is_error_handler)r�rhrj�error_handler_node�endsr�rl)4r�r5r{r|r^rryr[r3rx�strr�get_namer�r�rnr�r��logger�warning�RuntimeErrorr�r?r@r,r+r4rrr�next�iter�inspectrr�456parameters�keysrrrrTr�	NameErrorr��
StopIterationr�rHrrYr2r]r�)r�r�r�r�r�r�rhrjrkr�rlr�r�r��	character�inferred_input_schemar��hints�first_parameter_name�457input_hint�rtn�458rtn_origin�rtn_args�arg�459arg_origin�rargs�vals�resolved_input_schema�handler_node_names                             rvr�r��s���r�Z�Z���1�1�E�'�A��M�M�_�4�
��#�$���j�j��'�2�2�F�7�B��M�M�_�4�
��#�#�D��$4�t�$;�V�D��'��0���$��$�$��F��&�(�+�+����(���v�z�6�3C�3C�3L�3L�M���|� �L����=�=��N�N�:�
��$��$�$��F���W�V�V�W�V�Z�QU�5V�W�X�D��|� �L����>����:�:���v�d�V�+=�>�?�?��3�;�$�%�-��v�d�V�>�:�;�;� �&�)�I�� � ��	�{�"a�b���*�!%��1:��*	��6�"�"��F�#�#��G�F�J��=�>�>�'���460�(C�D�*�!�&�)�*��*� �'�+/��#�-�-� $�\�6� :��(�j�����,�(�&+�Y�Y�/C�%D�D�z�D�%�j�$�7�7�N�:�<V�<V�4>�1��)�)�H�-�-�3�-�!+�C��J�!�U�*�#+�C�=��#+�C�)3�C��J�)�W�4�&)��-7�461� %�$,�#�g�-�&.�s�m�3�U�3�&�u�Q�x�0�G�;�%-�e�A�h�%7�7�T�7�#���#��D�
�F�1�F�T�5F�5F�	�)-���$�"3�D�6� :�� �D�J�J�.� �9�:K�9L�L]�^���-:�#�x�-�,H�"�=�7H�PU�V��2�!�!�!%�
-�D�J�J�(�)��#�,�Z��-A�B�"�6�E�B��)�)�)�#4����462 �D�J�J�t��#�
.�,�"�6�E�B��2�)�)�#4����463 �D�J�J�t�� -�V�X�-=�>�"�6�E�B��!�.�.�)�)�#4����464 �D�J�J�t��$�<�'<���#����\�*����E�9�m�4�	��	�s�5E	S�AS�S)�(S)c���UR(a[RS5 [U[5(a�U[465:Xa[
S5eU[:Xa[
S5e[US5(d/U[SUR55;a[
SUS35eURRX45 U$UH6nU[466:Xa[
S5eX0R;dM)[
SUS	35e U[:Xa[
S5eU[467:waX R;a[
SUS	35eURR[U5U45 U$)468a�Add a directed edge from the start node (or list of start nodes) to the end node.469 470When a single start node is provided, the graph will wait for that node to complete471before executing the end node. When multiple start nodes are provided,472the graph will wait for ALL of the start nodes to complete before executing the end node.473 474Args:475    start_key: The key(s) of the start node(s) of the edge.476    end_key: The key of the end node of the edge.477 478Raises:479    ValueError: If the start key is `'END'` or if the start key or end key is not present in the graph.480 481Returns:482    Self: The instance of the `StateGraph`, allowing for method chaining.483�kAdding an edge to a graph that has already been compiled. This will not be reflected in the compiled graph.zEND cannot be a start nodezSTART cannot be an end noder�c3�*# �UH	upUv� M g7fr�rm)�.0r��_s   rv�	<genexpr>�&StateGraph.add_edge.<locals>.<genexpr>�s���B�&0�(�%��j�s�zAlready found path for node 'zB'.484For multiple edges, use StateGraph with an Annotated state key.zNeed to add_node `z` first)r�r�r�rxr�r?r�r@�hasattrr�r��addr�r��tuple)r��	start_key�end_keyr�s    rv�add_edge�StateGraph.add_edge�sY��"�=�=��N�N�:�
�485�i��%�%��C�� �!=�>�>��%�� �!>�?�?��4��,�,��c�B�&*�j�j�B�?�2�!�3�I�;�?V�V���486
�J�J�N�N�I�/�0��K��E���|� �!=�>�>��J�J�&� �#5�e�W�G�!D�E�E�	�487�e���:�;�;��c�>�g�Z�Z�7��1�'��'�B�C�C�������i� 0�'�:�;��ruc��UR(a[RS5 [USSS9nUR=(d SnX@R488U;a[
SURSUS35e[R"X#S5UR489UU'UR490UUR=n(aURU5 U$)	a$Add a conditional edge from the starting node to any number of destination nodes.491 492Args:493    source: The starting node. This conditional edge will run when494        exiting this node.495    path: The callable that determines the next node or nodes.496 497        If not specifying `path_map` it should return one or more nodes.498 499        If it returns `'END'`, the graph will stop execution.500    path_map: Optional mapping of paths to node names.501 502        If omitted the paths returned by `path` should be node names.503 504Returns:505    Self: The instance of the graph, allowing for method chaining.506 507!!! warning508    Without type hints on the `path` function's return value (e.g., `-> Literal["foo", "__end__"]:`)509    or a path_map, the graph visualization assumes the edge could transition to any node in the graph.510 511r�NTr��	conditionzBranch with name `z` already exists for node `�`)r�r�r�r2r�r�r�rF�	from_pathr�r�)r��source�path�path_mapr�r}s      rv�add_conditional_edges� StateGraph.add_conditional_edges�s���<�=�=��N�N�:�
�"�$�T��>���y�y�'�K���=�=��(�(��$�T�Y�Y�K�/J�6�(�RS�T��
�'1�&:�&:�4�4�&P��
�
�f��d�#��]�]�6�*�4�0�=�=�=�6�=����V�$��ruc�B�[U5S:a[S5eSnUH|n[U[5(a[U5S:XaUupCO[	U5nX@R512;a[SUS35eUR
XC5 UbURX$5 UnM~ U$)a3Add a sequence of nodes that will be executed in the provided order.513 514Args:515    nodes: A sequence of `StateNode` (callables that accept a `state` arg) or `(name, StateNode)` tuples.516 517        If no names are provided, the name will be inferred from the node object (e.g. a `Runnable` or a `Callable` name).518 519        Each node will be executed in the order provided.520 521Raises:522    ValueError: If the sequence is empty.523    ValueError: If the sequence contains duplicate node names.524 525Returns:526    Self: The instance of the `StateGraph`, allowing for method chaining.527�z$Sequence requires at least one node.Nr�z/Node names must be unique: node with the name 'z�' already exists. If you need to use two different runnables/callables with the same name (for example, using `lambda`), please provide them as tuples (name, runnable/callable).)�lenr�rxrr�r�r�r)r�r��
previous_namer�r�s     rv�add_sequence�StateGraph.add_sequence�s���.�u�:��>��C�D�D�$(�
��D��$��&�&�3�t�9��>�!�528��d�%�d�+���z�z�!� �E�d�V�Lv�v���529
�M�M�$�%��(��
�
�m�2� �M�!�$�ruc�.�UR[U5$)z�Specifies the first node to be called in the graph.530 531Equivalent to calling `add_edge(START, key)`.532 533Parameters:534    key (str): The key of the node to set as the entry point.535 536Returns:537    Self: The instance of the graph, allowing for method chaining.538)rr@�r�r�s  rv�set_entry_point�StateGraph.set_entry_point*s���}�}�U�C�(�(ruc�.�UR[X5$)a�Sets a conditional entry point in the graph.539 540Args:541    path: The callable that determines the next node or nodes.542 543        If not specifying `path_map` it should return one or more nodes.544 545        If it returns END, the graph will stop execution.546    path_map: Optional mapping of paths to node names.547 548        If omitted the paths returned by `path` should be node names.549 550Returns:551    Self: The instance of the graph, allowing for method chaining.552)r
r@)r�rrs   rv�set_conditional_entry_point�&StateGraph.set_conditional_entry_point7s��,�)�)�%��@�@ruc�.�URU[5$)aMarks a node as a finish point of the graph.553 554If the graph reaches this node, it will cease execution.555 556Parameters:557    key (str): The key of the node to set as the finish point.558 559Returns:560    Self: The instance of the graph, allowing for method chaining.561)rr?rs  rv�set_finish_point�StateGraph.set_finish_pointOs���}�}�S�#�&�&ruc�l�URVVs1sHup#UiM	 nnnURR5HupVURU5 M URR5H)upxUR562(dMURU5 M+ UH-n	X�R;dMU	[:wdM [SU	S35e [U;a[S5eURVV563s1sHup:U564iM	 nnn565URR5H�upVUR5H�up�U
R566bbU
R567R5HBn568X�R;aU569[:wa[SUSUSU570S35eURU5715 MD MtUR[5 URHnX�:wdM572URU5 M M� M� URR5H3upxUR573(dMURUR5745 M5 UH-nX�R;dMU[:wdM [SUS35e U(a'UH!nX�R;dM[S	US57535e SUlU$s snnfs sn576nf)Nz%Found edge starting at unknown node 'r�zOGraph must have an entrypoint: add at least one edge from START to another nodezAt 'z	' node, 'z' branch found unknown target 'z#Found edge ending at unknown node `rzInterrupt node `z` not foundT)r�r�r�rr�r�r@r��valuesr?�updater�)r��	interrupt�srcr��all_sourcesr�r�r��specr577r��all_targets�cond�branchr��targets                rv�validate�StateGraph.validate\sF��)-���9��v�s�s���9�#�}�}�2�2�4�O�E��O�O�E�"� 5��*�*�*�*�,�J�D��y�y�y�����%�-�"�F��Z�Z�'�F�e�O� �#H���PQ�!R�S�S�"���#��a��
�578*.���9��v�q�s���9�#�}�}�2�2�4�O�E� (��� 0����;�;�*�%�{�{�1�1�3���j�j�0�S�C�Z�",�"&�u�g�Y�t�f�<[�\_�[`�`a� b�#��$����,� 4� �O�O�C�(� $�579�580���=�'�O�O�D�1�!+�!1� 5��*�*�*�*�,�J�D��y�y�y��"�"�4�9�9�-�-�"�F��Z�Z�'�F�c�M� �#F�v�h�a�!P�Q�Q�"��!���z�z�)�$�'7��v�[�%I�J�J�"���
����Y:��":s�J*�3J0)�cache�store�interrupt_before�interrupt_after�debugr��transformersc581���[U5nSn	[R(GaURURUR582/n583URbU584RUR5 URR5HnU585RUR5 M  URR5HDnUR5H-n
U
RcMU586RU
R5 M/ MF [R"U587URS9n	[R"X5nU=(d /nU=(d /nURUS:wa
US:waUO/U-O/S9 [UR UR5885S:XaSUR UR589;aSOMUR UR590R#5VVs/sHup�[%U5(aMUPM snnn[UR5S:XaSUR;aSO@URR#5VVs/sHup�[%U5(aMUPM snnnUR&nSnUR(bs[*UR;a[-S[*S35e[*n[.[0[24"[5UR(US	S5919SURSSSS9URU'URR5H�nUR6(dUbUR8cUUlUR:bUR:cUR:UlUR6(d+UR<bUR<cUR<UlUR>cM�UR>bM�UR>UlM� URR#5VVs0sH5unnUR6(aMUR8cM(UUR8_M7 nnn[@[B[2[D[F4"S"0S
U_S0_SUR_S0_S0UREURHE[J[MUR50E_S[J_SS_SU_SU_SU_SU_SU_SS	_SU_SU_SU_SU_SU=(d S _S!U_6nU	Ul'URQ[JS5 URR#5Hup�URQX�5 M [S[UU[V5(a[WU5OU/UR5925Ul,[S[UU[V5(a[WU5OU/UR5Ul-UR\HunnUR_UU5 M UR`HunnUR_UU5 M URR#5H1unnUR#5Hup}URcUX}5 M M3 UR5$s snnfs snnfs snnf)#aHCompiles the `StateGraph` into a `CompiledStateGraph` object.593 594The compiled graph implements the `Runnable` interface and can be invoked,595streamed, batched, and run asynchronously.596 597Args:598    checkpointer: A checkpoint saver object or flag.599 600        If provided, this `Checkpointer` serves as a fully versioned "short-term memory" for the graph,601        allowing it to be paused, resumed, and replayed from any point.602 603        If `None`, it may inherit the parent graph's checkpointer when used as a subgraph.604 605        If `False`, it will not use or inherit any checkpointer.606 607        **Important**: When a checkpointer is enabled, you should pass a `thread_id`608        in the config when invoking the graph:609 610        ```python611        config = {"configurable": {"thread_id": "my-thread"}}612        graph.invoke(inputs, config)613        ```614 615        The `thread_id` is the key used to store and retrieve checkpoints. Use a616        unique ID for independent runs, or reuse the same ID to accumulate state617        across invocations (e.g., for conversation memory).618 619    interrupt_before: An optional list of node names to interrupt before.620    interrupt_after: An optional list of node names to interrupt after.621    debug: A flag indicating whether to enable debug mode.622    name: The name to use for the compiled graph.623    transformers: Optional sequence of `StreamTransformer` classes or624        configured factories. Classes and factories are instantiated625        per run whenever `stream_events(version="v3")` / `astream_events(version="v3")` is called and are626        propagated to subgraph scopes. Custom factories should follow627        the standard `StreamTransformer` constructor shape by628        accepting `scope` as their first argument. Appended after the629        built-in stream transformers.630 631Returns:632    CompiledStateGraph: The compiled `StateGraph`.633N)r�r��*)r"r�__root__z+Auto-generated default error handler node `r�Fr�Tr��builder�schema_to_mapperr�r�r��input_channels�stream_mode�updates�output_channels�stream_channels�checkpointer�interrupt_before_nodes�interrupt_after_nodes�
auto_validater0r-r,�node_error_handler_mapr��	LangGraph�stream_transformersrm)2rXr)�STRICT_MSGPACK_ENABLEDr�r�r�r��appendr�r r��build_serde_allowlistr��apply_checkpointer_allowlistr*rr�r�rJr�rk�_DEFAULT_ERROR_HANDLER_NODEr�rHrrYr2r�r�rhrjrlrar]rZr\r�r@r:�_serde_allowlist�attach_node�_pick_mapperrx�list�_output_mapper�
_state_mapperr��attach_edger��
attach_branch)r�r<r,r-r.r/r0r�r1�serde_allowlist�schema_typesr�r�r(r��valr:r;r��default_handler_namer%�	node_namer@r�r�r�r�s                           rv�compile�StateGraph.compile�sA��l1��>��7;���(�(�(��!�!��!�!��"�"�-�L�634�"�"�.��#�#�D�$7�$7�8��635�636�)�)�+���#�#�D�$5�$5�6�,� �M�M�0�0�2��&�o�o�/�F��*�*�6�$�+�+�F�,?�,?�@�0�3�%�:�:�$�����O�"�>�>���L�637,�1�r��)�/�R��	
�
�
�#�c�)�&6��%<�!�"��W��		�	638��4�<�<�� 2� 2�3�4��9��d�l�l�4�+=�+=�>�>�
�639!%���T�-?�-?� @� F� F� H�� H�H�C�'��,�� H��		��4�=�=�!�Q�&�:����+F�
�%)�M�M�$7�$7�$9��$9���AQ�RU�AV��$9��	��&�&��+/���!�!�-�*�d�j�j�8� ��3�4�4E�G���$?� �/<�S�(�]�/K�"��*�*�-���640�!�.�.�!�!�!%�0�D�J�J�+�,��J�J�%�%�'�D��)�)�(�4��+�+�3�*>��'��$�$�0�T�5F�5F�5N�$,�$9�$9��!�641�)�)��)�)�5��%�%�-�$,�$9�$9��!����+����0D�'�/�/���3(�:$(�:�:�#3�#3�#5�"642�#5��	�4��(�(�
/�-1�-D�-D�
/�I�t�.�.�.�#5�	�"643�&�f�h���&G�H�644��645��646� �.�.�647��	648�649��-�-���,�,���~�d�&7�&7�8��650�!�651�"�652�,�653�,�654�&�655�$4�656� #2�!657�" �#658�$�%659�&�'660�(�)661�*$:�+662�,�$���-663�.!-�/664��2%4��!����U�D�)����)�)�+�I�C�� � ��+�,�#/��/�4�0�0�
��!�!�"����	#665���".��/�4�0�0�
��!�!�"����	"666����*�*�J�E�3�� � ���,�%� �-�-�K�F�C�� � ���-�.� $�}�}�2�2�4�O�E�8� (��� 0����&�&�u�d�;�!1� 5�� � �"�"������r"667s*�)Y�Y�Y$�/Y$�Y*�Y*�.Y*)
r�r�r�r�r�r�r�r�r�r�r�r�r�r�)r�r�r�r�r�ztype[InputT] | Noner�ztype[OutputT] | Noner��Unpack[DeprecatedKwargs]r��None)668rhrgrjrirk�StateNode[Any, ContextT] | Nonerl�(float | timedelta | TimeoutPolicy | Noner�r&)r�r�)T)r�r�r}�	type[Any]r�rX)r��StateNode[NodeInputT, ContextT]r�r�r��dict[str, Any] | Noner�rXrhrgrjrirkrYr��'dict[str, str] | tuple[str, ...] | NonerlrZr�rWr�r&)r�r\r�r�r�r]r��type[NodeInputT]rhrgrjrirkrYr�r^rlrZr�rWr�r&)r�r�r�r\r�r�r�r]r�rXrhrgrjrirkrYr�r^rlrZr�rWr�r&)r��%str | StateNode[NodeInputT, ContextT]r��&StateNode[NodeInputT, ContextT] | Noner�r�r�r]r�r_rhrgrjrirkrYr�r^rlrZr�rWr�r&)r�r`r�rar�r�r�r]r�ztype[NodeInputT] | NonerhrgrjrirkrYr�r^rlrZr�rWr�r&)rzstr | list[str]rr�r�r&)r669r�r��Callable[..., Hashable | Sequence[Hashable]] | Callable[..., Awaitable[Hashable | Sequence[Hashable]]] | Runnable[Any, Hashable | Sequence[Hashable]]r�&dict[Hashable, str] | list[str] | Noner�r&)r�zWSequence[StateNode[NodeInputT, ContextT] | tuple[str, StateNode[NodeInputT, ContextT]]]r�r&)r�r�r�r&)rrbrrcr�r&)r"zSequence[str] | Noner�r&)r<rSr,zBaseCache | Noner-zBaseStore | Noner.�All | list[str] | Noner/rdr0r�r�z670str | Noner1z1Sequence[Callable[[tuple[str, ...]], Any]] | Noner�z5CompiledStateGraph[StateT, ContextT, InputT, OutputT])rnrorprqrrrsr�r��propertyr�r�rr�rr
rrrrr*rUrtrmrurvr`r`�s���D�L ��2�2�5�5�$�$�
(�(�
G�G�3�3��N���)�)��� � �67115�6B�672-1�.2�
6B�"�6B�.�6B�673*�6B�,�
6B�+�6B�674�6B�vDH�+/�9=�<@�
?�A�?�)�	?�6757�?�:�
?�676�?�B�677��678�6790�@�680�*.�!�CG�+/�9=�@D�<@�B�-�B��	B�681(�B��
B�A�B�)�B�7�B�>�B�:�B�+�B�682�B��B�H�683�*.�CG�+/�9=�@D�<@�F�-�F��	F�684(�F�'�
F�A�F�)�F�7�F�>�F�:�F�+�F�685�F��F�P��*.�!�CG�+/�9=�@D�<@�B��B�0�B�686�B�(�
B��B�A�B�)�B�7�B�>�B�:�B�+�B�687�B��B�H�:>�J�688�*.�CG�+/�9=�@D�<@�J�3�J�7�J�689�J�(�
J�'�J�A�J�)�J�7�J�>�J�:�J�+�J�690�J��J�^:>�{�691�*.�04�CG�+/�9=�@D�<@�{�3�{�7�{�692�{�(�
{�.�{�A�{�)�{�7�{�>�{�:�{�+�{�693�{�z4�x<@�
0��0�7�0�9�
0�694�0�d-�695�-�696�
-�^)�$<@�A�7�A�6979�A�698�
A�0'�.�d&*�`#�#'�"&�37�26���JN�`#�"�`#� �	`#�699 �`#�1�
`#�0�`#��`#��`#�H�`#�700?�`#�`#rur`c��^�\rSrSr%S\S'S\S'S\S'S\S'SU4S	jjrSSS701jjrSSSjjrSSjrSS
jr	SS.SSjjr702SU4SjjrSrU=r
$)raio�-StateGraph[StateT, ContextT, InputT, OutputT]r5�,dict[type[Any], Callable[[Any], Any] | None]r6�Callable[[Any], Any] | NonerLrMc�>>�[TU]"S0UD6 XlX lg�Nrm)�superr�r5r6)r�r5r6r�r�s    �rvr��CompiledStateGraph.__init__xs ���	���"�6�"��� 0�ruc��[URRURRURRURS5S9$)N�Input��typr�r�r�)�_get_json_schemar5r�r�r�r��r��configs  rv�get_input_jsonschema�'CompiledStateGraph.get_input_jsonschema�sD�� ����)�)��L�L�(�(��\�\�*�*����w�'�	703�	704ruc��[URRURRURRURS5S9$)N�Outputrp)rrr5r�r�r�r�rss  rv�get_output_jsonschema�(CompiledStateGraph.get_output_jsonschema�sD�� ����*�*��L�L�(�(��\�\�*�*����x�(�	705�	706ruc�^^�U[:XacURRURRR	5VVs/sHup4[U5(aMUPM snnmOY[
URR5URRR	5VVs/sHup4UPM	 snn-mS707UU4Sjjm[TS/:Xa[OTS9[[Ub"URb[UR5OSS94nU[:Xa2[[/[/[[!U5/S9UR"U'gUGbhU(aUROURR$n[
URRU5n['U5S:H=(a SU;nX`R(;aUR(Un	O[+Xv5n	X�R(U'[,R/U5n708UR0(a[3[45O
[7[4SS9URU709'[U710/U(aSOUU	[!U5/UR8UR:UR<UR>UR@URBURDS	9UR"U'g[Fes snnfs snnf)Nc�>�Ucg[U[5(a.UR5VVs/sHupUT;dM
X4PM snn$[U[5(aMUR[R711:XagUR
5VVs/sHupUT;dM
X4PM snn$[U[[45(a�U(a�[SU55(a�/nUH�n[U[5(aKUR[R712:XaM8URU4SjUR
555 McURT"U5=(d S5 M� U$[U5=n(a[U5(a[UT5$[SU3[R S9n[#U5es snnfs snnf)Nc3�B# �UHn[U[5v� M g7fr��rxrT�r��is  rvr��GCompiledStateGraph.attach_node.<locals>._get_updates.<locals>.<genexpr>�s���>��1�713�1�g�.�.����c3�>># �UHupUT;dM
X4v� M g7fr�rm)r��k�v�output_keyss   �rvr�r��s"����'�/D�t�q��[�HX�F�Q�F�/D�s��714rmzExpected dict, got )�message�715error_code)rxr�r�rT�graph�PARENT�_update_as_tuplesrKr�any�extendryr.r0rErB�INVALID_GRAPH_NODE_RETURN_VALUErC)	r�r�r�r9r��t�msg�_get_updatesr�s	       ��rvr��4CompiledStateGraph.attach_node.<locals>._get_updates�s�����}���E�4�(�(�+0�;�;�=�M�=�4�1�A��<L����=�M�M��E�7�+�+��;�;�'�.�.�0��',�'>�'>�'@��'@�t�q�A��DT�F�Q�F�'@����5�4��-�0�0���>��>�>�>�13���A�!�!�W�-�-��7�7�g�n�n�4�$����'�/0�/B�/B�/D�'�� ���|�A��'<�"�=�����E�{�"�!�"�(A�!�(D�(D�+�E�;�?�?�*�1�%��9�(�H�H���)��-�-��=N��s�G�G�G� Gr4)�mapper)r��static)�tags�triggersr��writersrF)�guard)r�r�r�r�r�rhrjr�r��boundrl)r�zNone | dict | Anyr�� Sequence[tuple[str, Any]] | None)$r@r5r�r�r�rJrKr�r�rP�	_get_root�_control_branchr��_control_staticrMrArNr�r�rr6rJ�_CHANNEL_BRANCH_TO�formatr�r<rr:r�rhrjr�r��runnablerlr�)
r�r�r�r�r��
write_entriesr�r7�is_single_inputr��branch_channelr�r�s
           @@rvrI�CompiledStateGraph.attach_node�su����%�<�!�L�L�0�0����1J�1J�K�Q�Q�S��S�D�A�'��*��S��K��t�|�|�4�4�5�"�l�l�2�2�8�8�:�9�:�d�a��:�9��K�$	.�$�$	.�
-�$	.�$	.�P
#�$/�J�<�$?�y�\�
�
#�&��#��	�	�(=�'�t�y�y�1��	
�	716Q717�
��%�<�(� �\����%�m�4�5�	�D�J�J�s�O��
�04�4�,�,�$�,�,�:S�:S�L�!�$�,�,�"6�"6�|�"D�E�N�!�.�1�Q�6�W�:��;W�O��4�4�4��.�.�|�<��%�n�C��6<�%�%�l�3�/�6�6�s�;�N��:�:�%�S�)�#�C�u�5�
�M�M�.�)�718)�(�)�(7�*�^��%�m�4�5����!�.�.�!�.�.�!%�!6�!6�#'�#:�#:��m�m�����D�J�J�s�O�"���M��9s�K
�%K
�5Kc	���[U[5(a[U[:waPURURR[
[[RU5S5455 ggU[:wa�SSRU5SU3nURRUR(a'[[[U55URU'O&[![[U55URU'URUR"RU5 UH>nURURR[
[X45455 M@ gg)Nzjoin:�+�:)rxr�r?r�r�rDrNrOr�r�r�r5r�r>r�r�r=r�)r�r�r��channel_namer�s     rvrN�CompiledStateGraph.attach_edges'���f�c�"�"��c�z��719�720�6�"�*�*�1�1� �*�+=�+D�+D�S�+I�4�P�R�����C�Z�"�3�8�8�F�#3�"4�A�c�U�;�L��|�|�!�!�#�&�,�,�.J���V��/��
�
�l�+�/@��S��[�.Q��
�
�l�+��J�J�s�O�$�$�+�+�L�9����721�722�5�!�)�)�0�0� �"3�L�"H�!J�K�� �ruT)�with_readerc�j�SSSjjnU(a�UR=(dR XRR;a#URRUROURRn[	URR723U5nX`R;aURUnO[Xv5nX�RU'[[RUS/:XaUSOUSUS9n	OSn	URURRURXY55 g)Nc���UVs/sHYnU(aOU[:wdM[U[5(d+[U[:XaUO[RU5S5OUPM[ nnU(d/$U$s snfr�)r?rxrVrOr�r�)�packetsr��p�writess    rv�724get_writes�4CompiledStateGraph.attach_branch.<locals>.get_writess���!�725�!�A�"�D��S���&�a��.�.�&��#�X��+=�+D�+D�Q�+G����	�!�
�726���	��M��727s�A2�AA2r4rT)�select�freshr�)F)r�zSequence[str | Send]r�r�r�z"Sequence[ChannelWriteEntry | Send])r�r5r�r�rKr�r6rJrrL�do_readr�rD�run)728r�r�r�r(r�r�r}r�r��readers729          rvrO� CompiledStateGraph.attach_branchs��;@�	�)�	�37�	�
/�	�$��(�(���L�L�.�.�.����"�"�5�)�6�6��\�\�.�.�
�730�D�L�L�0�0��8�9�H��.�.�.��.�.�v�6��%�h�7��06�%�%�f�-�=D��#�#�&.�:�,�&>�x��{�H���>�F��F�	
�731�732�5��!�!�(�(����J�)G�Hruc�>�[TU]U5 USnUSnUSnU(dgUSS:�ag[U5H�nURS5(dMUR	S5S	nX`R733;aM@S734U3nXs;a[
X7URU55OURU5nURU05UR[054H6n	XY;dM735U	RU5n736Xy;a[
X�U5X�'M2X�U'M8 Xr;aXR;aURU5X''X�U'M� [U5GHnURS5(dMURS5S:XdM3UR	S5SnX`R737;aMXS738U3nXs;a[
X7URU55OURU5nURU05UR[054H6n	XY;dM739U	RU5n740Xy;a[
X�U5X�'M2X�U'M8 Xr;aXR;aURU5X''X�U'GM [UR7415RU5(Gdx[[5nURRH0up�U[ :wdMU
[":wdMX�R%U
5 M2 [U5GHnU[ :XaMXPR742;dM!URU5nURU[&5nX�H�n
S743U
3nXs;a[
X7U5OUnURU
05UR[054H6n	XY;dM744U	RU5n745Xy;a[
X�U5X�'M2X�U'M8 Xr;a
U[&LaX�U'X�U'M� [U;dM�U[RU[&5 GM gg)
z+Migrate a checkpoint to new channel layout.�channel_values�channel_versions�
versions_seenNr��zstart:r�rz746branch:to:zbranch:�����)rl�_migrate_checkpointrK�747startswith�splitr��max�popr�r*�countr��748isdisjointrr5r�r@r?rDr5)r��749checkpointr �versions�seenr�r��new_k�new_v�ss�s�source_to_targetr�r�r��cr�s                �rvr��&CompiledStateGraph._migrate_checkpointLs����
��#�J�/��,�-���0�1���/�*�����c�?�a����h��A��|�|�H�%�%��w�w�s�|�A����z�z�)��$�T�F�+���(�������a��9�!���a��� �8�8�D�"�-�t�x�x�	�2�/F�G�B��w��F�F�1�I�� �;�(+�A�%�y�(9�B�I�()�u�I�
H��&�1�;�$*�J�J�q�M�F�M�"'���3 �8�h��A��|�|�I�&�&�1�7�7�3�<�1�+<��w�w�s�|�B�'���z�z�)��$�T�F�+���(�������a��9�!���a��� �8�8�D�"�-�t�x�x�	�2�/F�G�B��w��F�F�1�I�� �;�(+�A�%�y�(9�B�I�()�u�I�
H��&�1�;�$*�J�J�q�M�F�M�"'���3 �6�4�:�:��)�)�(�3�3�*�4�0��"�l�l�0�0�750���E�>�c�S�j�$�+�2�2�3�7�1��(�^����:���751�752�?� ���Q��A��753�754�1�g�.�A�/�2��",�S�E� 2��;@�;L��H�O�Q� 7�RS��#'�8�8�C��#4�d�h�h�y�"�6M�"N�B� �w�$&�F�F�1�I��#(�;�03�A�%�y�0A�B�I�01�u�I�
#O�!�.�1�G�3C�,-�5�M�*/���! 3�$!�D�(��Y��+�+�A�w�7�3$�
4ru)r5r6)r5rgr6rhr�rr�rXr�)rtzRunnableConfig | Noner��dict[str, Any])r�r�r�z#StateNodeSpec[Any, ContextT] | Noner�rX)r�zstr | Sequence[str]r�r�r�rX)755r�r�r�r�r(rFr�r�r�rX)r�r r�rX)rnrorprqrsr�ruryrIrNrOr�rt�
__classcell__)r�s@rvraraos����;�:�B�B�/�/�.�.�	1�?�	1�G�		1�756�	1�757�
	1�/3�758�+�759�	�760�/3�761�+�762�	�763�h�T�6QU�/I��/I� #�/I�-7�/I�IM�/I�	
�/I�bg8�g8rurac��US/:Xag[U5(a5[U[5(d[U5(a[	[764U5$g)Nr4)r
�765issubclassr"r766r�
_coerce_state)�767state_keysr}s  rvrJrJ�s@���j�\�!���v���J�v�y�9�9�\�&�=Q�=Q��}�f�-�-�ru�_Sc��U"S0UD6$rkrm)r}r�s  rvr�r��s���?�E�?�ruc��[U[5(a	[U44$/n[U[5(aUR	U5 OL[U[768[45(a1UH+n[U[5(dMUR	U5 M- /nUH�nUR[R:Xa[U5e[UR[[45(a
UR/OURnUHzn[U[5(aUR	[U45 M1[U[5(dMHU[:wdMTUR	[RU5S45 M| M� U$r�)rxrVr-rTrDrKrr�r�rD�gotor�r?r�r�)�value�commands�cmdr��command�goto_targets�gos       rvr�r��s&���%������� � � �H��%��!�!������	�E�D�%�=�	)�	)��C��#�w�'�'�����$��"$�C����=�=�G�N�N�*���(�(�)�����c�{�C�C�W�\�\�N����	��B��"�d�#�#��769�770�E�2�;�'��B��$�$��s���771�772�.�5�5�b�9�4�@�A�
���Jruc�8�[U[5(aGUR5VVs/sH)upU[:XaUO[RU5SU4PM+ snn$UVs/sH&o3[:XaUO[RU5SS4PM( sn$s snnfs snfr�)rxr�r�r?r�r�)r�r��label�es    rvr�r��s����$����!�J�J�L�773�(����s�(�Q� 2� 9� 9�!� <�d�E�J�(�774�	775�TX�776�SW�a�s�(�Q� 2� 9� 9�!� <�d�D�I�SW�777�	778��779��780781s�0B�!-Bc���[U[5(a/UR[R:XagUR	5$[U[782[45(a�U(a�[SU55(av/nUHln[U[5(aAUR[R:XaM8URUR	55 MYURSU45 Mn U$UbSU4/$g)Nrmc3�B# �UHn[U[5v� M g7fr�r~rs  rvr��_get_root.<locals>.<genexpr>�s���6��1�783�1�g�&�&��r�r4)784rxrTr�r�r�rKrr�r�rD)r�r9r�s   rvr�r��s����%��!�!��;�;�'�.�.�(���&�&�(�(��5�4��-�(�(���6��6�6�6�)+���A��!�W�%�%��7�7�g�n�n�,�����q�2�2�4�5����785�A��/�
���	�	��U�#�$�$�786ruc	���[US5(dS[SUSS90004$[USS9nUR5VVs0sHup#US:wdM
U[X#5_M nnnUR5VVs0sHupV[	U[7875(dMXV_M  snnUR5VVs0sHupV[
U5(dMXV_M snnU4$s snnfs snnfs snnf)Nrsr4Fr�T)�include_extras�	__slots__)r��_get_channelrr�rxr7rJ)r}r�r�rq�all_keysr�r�s       rvr�r�	s����6�,�-�-�
��j�&��N�O���788�	789� ��t�<�J�$�)�)�+��+�I�D��;��	&��l�4�%�%�+�
��#�.�.�*�I�*�$�!�j��K�.H����*�I�"�.�.�*�B�*�$�!�.>�q�.A����*�B�������	J��Bs#�C�C�5C�C�0C"�790C"c��gr�rm�r��791annotationr�s   rvr�r� s��rur�c��gr�rmr�s   rvr�r�&s��&)ruc�X�[US5(a)UR[[4;aURSn[X5=n(aU(aU$[
SUS35e[U5=n(aXlU$[U5=n(aXlU$[U5nXlU$)N�792__origin__rzThis z not allowed in this position)r�r�r%r$�__args__�_is_field_managed_valuer��_is_field_channelr��_is_field_binopr;)r�r�r��managerr��fallbacks      rvr�r�,s����z�<�(�(�Z�-B�-B���G�.� �(�(��+�793�)�$�;�;�w�;���N��u�Z�L�0M�N�O�O�%�j�1�	1��	1�����#�J�/�	/��	/�����#�J�/�H��L��Oruc�P�[US5(GaURnUGHn[U[5(a�[U[5(a|[US5(akUR794n[US5(a)UR795[[4;aURSnURURUURS9nUs $[U5(dM�[U[5(dM�U"[US5(aUR7965s $U5s $ g)N�__metadata__r�r)�snapshot_frequency)r�r�rxr7r9r�r%r$r�r��reducerr�r
r�)rq�meta�item�origins    rvr�r�Fs����s�N�#�#������D��$��,�,��d�L�1�1�g�c�<�6P�6P� �^�^�F��v�|�4�4��9J�9J� �#�O�:�"(����!3���>�>�����+/�+B�+B�*��D�797������:�d�K�#@�#@��g�c�<�.H�.H�C�N�N�R�R�c�R�R�)�*ruc�H�[US5(a�URn[U5S:�av[US5(ac[	US5n[URR55n[SU55S:Xa[XS5$[SU35eg)Nr�rr�c3�l# �UH*nURURUR4;v� M, g7fr�)�kind�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORD)r�r�s  rvr��"_is_field_binop.<locals>.<genexpr>is1����#���F�F�q�0�0�!�2I�2I�J�J�#�s�24r�z5Invalid reducer signature. Expected (a, b) -> c. Got )r�r�r�callablerrKr�r �sumr8r�)rqr��sig�paramss    rvr�r�bs����s�N�#�#������t�9��>�h�t�B�x�0�0��D��H�%�C��#�.�.�/�/�1�2�F���#����	�/�s��H�=�=� �K�C�5�Q���ruc��[US5(aGURn[U5S:�a,[US5=(d USn[	U5(aU$[U5b)[U5=n(aUS=n(a[
X5$g)Nr�rr�r)r�r�rrrJrr�)r�rqr��798decoration�args�799inner_types      rvr�r�ws����s�N�#�#������t�9��>�#�D��H�-�9��b��J��800�+�+�!�!�	�3��#��c�]�
"�T�
"���7�
"�Z�
"�&�t�8�8�ruc
�b�[U5(a%[U[5(aUR5$[	U5(a[U5R
5$[XR55n[U5S:Xa2USS:Xa)[UX$SRS4S9R5$[UXVs0sHKnXR;dM801[X%[5(dM#UX%R[UX%RU54_MM snS9R5$s snf)Nrrr4)�root)�field_definitions)r
r�r"�model_json_schemar(r#�json_schemarKr�rr1�802UpdateTyperxr7r/)rqr�r�r�r�r�s      rvrrrr�s/���s�|�|�803�3�	�2�2��$�$�&�&�	�c�	�	��3��+�+�-�-��G�L�%�%�'�(���t�9��>�d�1�g��3����A�w�'�2�2�D�9�� ��!�
"�804 ��%�\�
#�*���}�	�*4�H�K��)M�	�A� ��.�.�-� !� (�� 6� 6� #��	�	�*�
#��  ��!�!
"��
#s�	D,805�D,806�-,D,807)r}ztype[Any] | Anyr�rX)r�zStateNode[Any, ContextT]r�r�)r�z
Sequence[str]r}r[r�ri)r}ztype[_S]r�r�r�r�)r�rr�zSequence[tuple[str, Any]])r�z tuple[str, ...] | dict[str, str]r�z%Sequence[tuple[str, Any, str | None]])r�rr�r�)r}z808type[dict]r�zJtuple[dict[str, BaseChannel], dict[str, ManagedValueSpec], dict[str, Any]])r�r�r�rr�zLiteral[False]r�r7)r�r�r�rr�z
Literal[True]r��BaseChannel | ManagedValueSpec)r�r�r�rr�r�r�r)rqr[r�zBaseChannel | None)rqr[r�zBinaryOperatorAggregate | None)r�r�rqr[r�zManagedValueSpec | None)809rqryr�r�r�r�r�r�r�r�)��810__future__rr��loggingrzr{�collectionsr�collections.abcrrrr�dataclassesr	r811�datetimer�	functoolsrr
rrr�typesrrrrrrrrrrrr�langchain_core.runnablesrr�langgraph.cache.baser�langgraph.checkpoint.baser �langgraph.store.baser!�pydanticr"r#�typing_extensionsr$r%r&r'r(�langgraph._internalr)�langgraph._internal._constantsr*r+r,r-�langgraph._internal._fieldsr.r/r0�langgraph._internal._pydanticr1�langgraph._internal._runnabler2�langgraph._internal._timeoutr3�langgraph._internal._typingr4r5r6�langgraph.channels.baser7�langgraph.channels.binopr8�langgraph.channels.deltar9�"langgraph.channels.ephemeral_valuer:�langgraph.channels.last_valuer;r<�&langgraph.channels.named_barrier_valuer=r>�langgraph.constantsr?r@rA�langgraph.errorsrBrCrDrE�langgraph.graph._branchrF�langgraph.graph._noderGrH�langgraph.managed.baserIrJ�langgraph.pregelrK�langgraph.pregel._readrLrM�langgraph.pregel._writerNrOrP�langgraph.typesrQrRrSrTrUrVrWrX�langgraph.typingrYrZr[r\r]�langgraph.warningsr^r_�__all__�	getLoggerrnr�r�rGrer~r�r`rarJr�r�r�r�r�r�r�r�r�r�rrrmrurv�<module>r:s���"���
��#�C�C�/���<�<��&����>�*�0�*�+�O�O�&�����8127�<�>�L�L�/�<�1�=�I��7�6���/�:��$�:���813	�	�	�K�J�W�814.��	�	�	�8�	$��#��9�����)�)��)�	�@�j#����6�7�:�;�j#�Z'D8�815�6�8�V�W�,�-��F�H�f�g�-�.�D8�N816���'0�� ��
�T�]����:817�818*�819�*�820�%�.���O��.821��822
����2@����823��824825�BF�)�826
�)��)�2?�)�#�)�827�)�:>��828
����26��#��4�8�*�&""�	
�""�
�""��""��	""�829�""ru
codekingpro/portable-devtools · Team Ai