
    <i             
         S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	J
r
Jr  S SKJrJrJrJrJrJr  S SKJr  S SKJr  S SKJr  S SKJrJrJrJr  S S	KJrJ r   S S
K!J"r"  S SK#J$r$  S SK%J&r&J'r'  S SK(J)r)J*r*J+r+  S SK,J-r-  S SK.J/r/  S SK0J1r1J2r2J3r3  S SK4J5r5  S SK6J7r7J8r8  S SK9J:r:J;r;J<r<J=r=  S SK>J?r?J@r@JArAJBrBJCrCJDrD  S SKEJFrFJGrGJHrHJIrIJJrJJKrKJLrLJMrMJNrNJOrOJPrPJQrQJRrRJSrSJTrTJUrUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\  S SK]J^r^  S SK_J`r`Jara  S SKbJcrcJdrdJereJfrf  S SKgJhrhJiri  S SKjJkrk  S SKlJmrm  S SKnJoro  S SKpJqrq  S SKrJsrsJtrtJuruJvrv  S SKwJxrx  S S KyJzrzJ{r{J|r|J}r}J~r~  S S!KJr  S S"KJrJrJrJr  S S#KJr  S S$KJrJr  S S%KJrJr  S S&KJr  S S'KJrJr  S S(KJr  S S)KJr  S S*KJr  S S+KJrJr  S S,KJrJr  S S-KJrJrJr  S S.KJrJrJr  S S/KJrJr  S S0KJrJrJrJrJrJrJrJrJrJr  S S1KJrJrJrJr  S S2KJr   S S3KJr  S4r\\&/\'4   \-  r " S5 S65      r " S7 S8\\\\\4   \\\\\4   5      rS<S9 jr            S=S: jr      S>S; jrg! \ a    Sr N]f = f)?    )annotationsN)defaultdictdeque)AsyncIterator	AwaitableCallableIteratorMappingSequence)is_dataclass)partial)isclass)AnyGenericcastget_type_hints)UUIDuuid5)	get_debug)RunnableSequence)InputOutput)RunnableConfig%get_async_callback_manager_for_configget_callback_manager_for_config)Graph)	BaseCache)BaseCheckpointSaver
CheckpointCheckpointTuple)	BaseStore)	BaseModelTypeAdapter)SelfUnpack
deprecatedis_typeddict)ensure_configmerge_configspatch_checkpoint_mappatch_configpatch_configurablerecast_checkpoint_ns)CACHE_NS_WRITESCONFCONFIG_KEY_CACHECONFIG_KEY_CHECKPOINT_IDCONFIG_KEY_CHECKPOINT_NSCONFIG_KEY_CHECKPOINTERCONFIG_KEY_DURABILITYCONFIG_KEY_NODE_FINISHEDCONFIG_KEY_READCONFIG_KEY_RUNNER_SUBMITCONFIG_KEY_RUNTIMECONFIG_KEY_SENDCONFIG_KEY_STREAMCONFIG_KEY_TASK_IDCONFIG_KEY_THREAD_IDERRORINPUT	INTERRUPTNS_ENDNS_SEPNULL_TASK_IDPUSHTASKS)create_model)
AsyncQueue	SyncQueue)RunnableRunnableLikeRunnableSeqcoerce_to_runnable)MISSINGDeprecatedKwargs)BaseChannel)Topic)
get_config)END)	ErrorCodeGraphRecursionErrorInvalidUpdateErrorcreate_error_message)ManagedValueSpec)PregelTaskWrites_scratchpadapply_writes
local_readprepare_next_tasks)
identifier)channels_from_checkpointcopy_checkpointcreate_checkpointempty_checkpoint)
draw_graph)	map_inputread_channels)AsyncPregelLoopSyncPregelLoop)StreamMessagesHandler)DEFAULT_BOUND
PregelNode)RetryPolicy)PregelRunner)get_new_channel_versions)validate_graphvalidate_keys)ChannelWriteChannelWriteEntry)get_bolded_textget_colored_texttasks_w_writes)PregelProtocolStreamChunkStreamProtocol)DEFAULT_RUNTIMERuntime)
AllCachePolicyCheckpointerCommand
Durability	InterruptSendStateSnapshotStateUpdate
StreamMode)ContextTInputTOutputTStateT)LangGraphDeprecatedSinceV10)_StreamingCallbackHandler)NodeBuilderPregelc                     \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S
\S'   S\S'   S\S'   S\S'     S S jr    S!S jrSS.     S"S jjr    S#S jr	    S$S jr
      S%S jrS&S jrS'S jrS(S jrS)S jrSrg)*r      )	_channels	_triggers_tags	_metadata_writes_bound_retry_policy_cache_policyzstr | list[str]r   z	list[str]r   r   dict[str, Any]r   zlist[ChannelWriteEntry]r   rH   r   zlist[RetryPolicy]r   CachePolicy | Noner   c                |    / U l         / U l        / U l        0 U l        / U l        [
        U l        / U l        S U l        g N)	r   r   r   r   r   rg   r   r   r   selfs    e/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/site-packages/langgraph/pregel/main.py__init__NodeBuilder.__init__   s>     
#!    c                    U R                   (       d  Xl         O[        S5      eU R                  R                  U5        U $ )zSubscribe to a single channel.zQCannot subscribe to single channels when other channels are already subscribed to)r   
ValueErrorr   appendr   channels     r   subscribe_onlyNodeBuilder.subscribe_only   s9    
 ~~$Nc  	g&r   T)readc               |   [        U R                  [        5      (       a  [        S5      eU(       a=  U R                  (       d  [	        U5      U l        OU R                  R                  U5        [        U[        5      (       a  U R                  R                  U5        U $ U R                  R                  U5        U $ )at  Add channels to subscribe to. Node will be invoked when any of these
channels are updated, with a dict of the channel values as input.

Args:
    channels: Channel name(s) to subscribe to
    read: If `True`, the channels will be included in the input to the node.
        Otherwise, they will trigger the node without being sent in input.

Returns:
    Self for chaining
z@Cannot subscribe to channels when subscribed to a single channel)
isinstancer   strr   listextendr   r   )r   r   channelss      r   subscribe_toNodeBuilder.subscribe_to   s      dnnc**R  >>!%h%%h/h$$NN!!(+  NN!!(+r   c                    [        U R                  [        5      (       d   S5       eU R                  R                  U5        U $ )zFAdds the specified channels to read from, without subscribing to them.zBCannot read additional channels when subscribed to single channels)r   r   r   r   )r   r   s     r   	read_fromNodeBuilder.read_from   s>    
 $..$// 	
P	
/ 	h'r   c           	         U R                   [        La&  [        U R                   [        USSS95      U l         U $ [        USSS9U l         U $ )zAdds the specified node.NT)nametrace)r   rg   rJ   rK   )r   nodes     r   doNodeBuilder.do   sM    
 ;;m+%/4tLDK
  -TDIDKr   c                    U R                   R                  S U 5       5        U R                   R                  S UR                  5        5       5        U $ )zAdd channel writes.

Args:
    *channels: Channel names to write to
    **kwargs: Channel name and value mappings

Returns:
    Self for chaining
c              3  f   #    U  H'  n[        U[        5      (       a  [        U5      OUv   M)     g 7fr   )r   r   ro   ).0cs     r   	<genexpr>'NodeBuilder.write_to.<locals>.<genexpr>  s*      
GO!Jq#$6$6a A=xs   /1c              3  j   #    U  H)  u  p[        U5      (       a	  [        XS 9O[        XS9v   M+     g7f))mapper)valueN)callablero   )r   kvs      r   r   r     s:      
 ' {{ a*"1./ 's   13)r   r   items)r   r   kwargss      r   write_toNodeBuilder.write_to	  sS     	 
GO
 	
 	 
 	
 	
 r   c                r    U R                   R                  U5        U R                  R                  U5        U $ )z!Add tags or metadata to the node.)r   r   r   update)r   tagsmetadatas      r   metaNodeBuilder.meta#  s+    

$h'r   c                <    U R                   R                  U5        U $ )z Adds retry policies to the node.)r   r   )r   policiess     r   add_retry_policiesNodeBuilder.add_retry_policies)  s    !!(+r   c                    Xl         U $ )z Adds cache policies to the node.)r   )r   policys     r   add_cache_policyNodeBuilder.add_cache_policy.  s    #r   c                    [        U R                  U R                  U R                  U R                  [        U R                  5      /U R                  U R                  U R                  S9$ )zBuilds the node.)r   triggersr   r   writersboundretry_policycache_policy)
rh   r   r   r   r   rn   r   r   r   r   r   s    r   buildNodeBuilder.build3  sS    ^^^^^^!$,,/0++++++	
 		
r   )r   r   r   r   r   r   r   r   NreturnNone)r   r   r   r$   )r   r   r   boolr   r$   )r   r   r   r$   )r   rI   r   r$   )r   zstr | ChannelWriteEntryr   _WriteValuer   r$   )r   r   r   r   r   r$   )r   ri   r   r$   )r   ry   r   r$   )r   rh   )__name__
__module____qualname____firstlineno__	__slots____annotations__r   r   r   r   r   r   r   r   r   r   __static_attributes__ r   r   r   r      s    	I $$$$%%
"	
" 
&   
	B		 
	 
*  
	4


r   r   c                  ^  ^  \ rS rSr% SrS\S'   S\S'   SrS\S	'    S
rS\S'    S\S'   SrS\S'    S\S'   S\S'   S\S'   Sr	S\S'    S\S'    Sr
S\S'    SrS\S'    SrS\S'    SrS \S!'    SrS"\S#'    SrS$\S%'    SrS&\S''   S(rS)\S*'   S+\S,'   S-SS
SSSSSSSSSSSSSS(S..                                             SaS/ jjr SbS
S0.     ScS1 jjjr SbS
S0.     ScS2 jjjrSdS3 jrSbSeS4 jjrSbSfS5 jjrSgS6 jr\" S7SS89SS9.ShS: jj5       r\" S;SS89SS9.   SiS< jj5       rSjS= jr\SkS> j5       rSbSlU 4S? jjjr Sb   SmS@ jjr \SkSA j5       r! Sb   SlU 4SB jjjr" Sb   SmSC jjr#\SnSD j5       r$\SoSE j5       r%SS
SF.     SpSG jjr&SS
SF.     SqSH jjr'SrSI jr(  Ss         StSJ jjr)  Ss         StSK jjr*S
SL.     SuSM jjr+S
SL.     SuSN jjr,SSSSO.         SvSP jjr-SSSSO.         SwSQ jjr.      SxSR jr/      SxSS jr0  Sy         SzST jjr1  Sy         S{SU jjr2SSV.               S|SW jjr3 SbSSSSSSSS
SSX.	                         S}SY jjjr4 SbSSSSSSSS
SSX.	                         S~SZ jjjr5 SbSSSSSSSS[.                     SS\ jjjr6 SbSSSSSSSS[.                     SS] jjjr7SbSS^ jjr8SbSS_ jjr9S`r:U =r;$ )r   iA  uP  Pregel manages the runtime behavior for LangGraph applications.

## Overview

Pregel combines [**actors**](https://en.wikipedia.org/wiki/Actor_model)
and **channels** into a single application.
**Actors** read data from channels and write data to channels.
Pregel organizes the execution of the application into multiple steps,
following the **Pregel Algorithm**/**Bulk Synchronous Parallel** model.

Each step consists of three phases:

- **Plan**: Determine which **actors** to execute in this step. For example,
    in the first step, select the **actors** that subscribe to the special
    **input** channels; in subsequent steps,
    select the **actors** that subscribe to channels updated in the previous step.
- **Execution**: Execute all selected **actors** in parallel,
    until all complete, or one fails, or a timeout is reached. During this
    phase, channel updates are invisible to actors until the next step.
- **Update**: Update the channels with the values written by the **actors**
    in this step.

Repeat until no **actors** are selected for execution, or a maximum number of
steps is reached.

## Actors

An **actor** is a `PregelNode`.
It subscribes to channels, reads data from them, and writes data to them.
It can be thought of as an **actor** in the Pregel algorithm.
`PregelNodes` implement LangChain's
Runnable interface.

## Channels

Channels are used to communicate between actors (`PregelNodes`).
Each channel has a value type, an update type, and an update function – which
takes a sequence of updates and
modifies the stored value. Channels can be used to send data from one chain to
another, or to send data from a chain to itself in a future step. LangGraph
provides a number of built-in channels:

### Basic channels: LastValue and Topic

- `LastValue`: The default channel, stores the last value sent to the channel,
   useful for input and output values, or for sending data from one step to the next
- `Topic`: A configurable PubSub Topic, useful for sending multiple values
   between *actors*, or for accumulating output. Can be configured to deduplicate
   values, and/or to accumulate values over the course of multiple steps.

### Advanced channels: Context and BinaryOperatorAggregate

- `Context`: exposes the value of a context manager, managing its lifecycle.
  Useful for accessing external resources that require setup and/or teardown. eg.
  `client = Context(httpx.Client)`
- `BinaryOperatorAggregate`: stores a persistent value, updated by applying
   a binary operator to the current value and each update
   sent to the channel, useful for computing aggregates over multiple steps. eg.
  `total = BinaryOperatorAggregate(int, operator.add)`

## Examples

Most users will interact with Pregel via a
[StateGraph (Graph API)][langgraph.graph.StateGraph] or via an
[entrypoint (Functional API)][langgraph.func.entrypoint].

However, for **advanced** use cases, Pregel can be used directly. If you're
not sure whether you need to use Pregel directly, then the answer is probably no
- you should use the Graph API or Functional API instead. These are higher-level
interfaces that will compile down to Pregel under the hood.

Here are some examples to give you a sense of how it works:

Example: Single node application
    ```python
    from langgraph.channels import EphemeralValue
    from langgraph.pregel import Pregel, NodeBuilder

    node1 = (
        NodeBuilder().subscribe_only("a")
        .do(lambda x: x + x)
        .write_to("b")
    )

    app = Pregel(
        nodes={"node1": node1},
        channels={
            "a": EphemeralValue(str),
            "b": EphemeralValue(str),
        },
        input_channels=["a"],
        output_channels=["b"],
    )

    app.invoke({"a": "foo"})
    ```

    ```con
    {'b': 'foofoo'}
    ```

Example: Using multiple nodes and multiple output channels
    ```python
    from langgraph.channels import LastValue, EphemeralValue
    from langgraph.pregel import Pregel, NodeBuilder

    node1 = (
        NodeBuilder().subscribe_only("a")
        .do(lambda x: x + x)
        .write_to("b")
    )

    node2 = (
        NodeBuilder().subscribe_to("b")
        .do(lambda x: x["b"] + x["b"])
        .write_to("c")
    )


    app = Pregel(
        nodes={"node1": node1, "node2": node2},
        channels={
            "a": EphemeralValue(str),
            "b": LastValue(str),
            "c": EphemeralValue(str),
        },
        input_channels=["a"],
        output_channels=["b", "c"],
    )

    app.invoke({"a": "foo"})
    ```

    ```con
    {'b': 'foofoo', 'c': 'foofoofoofoo'}
    ```

Example: Using a Topic channel
    ```python
    from langgraph.channels import LastValue, EphemeralValue, Topic
    from langgraph.pregel import Pregel, NodeBuilder

    node1 = (
        NodeBuilder().subscribe_only("a")
        .do(lambda x: x + x)
        .write_to("b", "c")
    )

    node2 = (
        NodeBuilder().subscribe_only("b")
        .do(lambda x: x + x)
        .write_to("c")
    )


    app = Pregel(
        nodes={"node1": node1, "node2": node2},
        channels={
            "a": EphemeralValue(str),
            "b": EphemeralValue(str),
            "c": Topic(str, accumulate=True),
        },
        input_channels=["a"],
        output_channels=["c"],
    )

    app.invoke({"a": "foo"})
    ```

    ```pycon
    {"c": ["foofoo", "foofoofoofoo"]}
    ```

Example: Using a BinaryOperatorAggregate channel
    ```python
    from langgraph.channels import EphemeralValue, BinaryOperatorAggregate
    from langgraph.pregel import Pregel, NodeBuilder


    node1 = (
        NodeBuilder().subscribe_only("a")
        .do(lambda x: x + x)
        .write_to("b", "c")
    )

    node2 = (
        NodeBuilder().subscribe_only("b")
        .do(lambda x: x + x)
        .write_to("c")
    )


    def reducer(current, update):
        if current:
            return current + " | " + update
        else:
            return update


    app = Pregel(
        nodes={"node1": node1, "node2": node2},
        channels={
            "a": EphemeralValue(str),
            "b": EphemeralValue(str),
            "c": BinaryOperatorAggregate(str, operator=reducer),
        },
        input_channels=["a"],
        output_channels=["c"],
    )

    app.invoke({"a": "foo"})
    ```

    ```con
    {'c': 'foofoo | foofoofoofoo'}
    ```

Example: Introducing a cycle
    This example demonstrates how to introduce a cycle in the graph, by having
    a chain write to a channel it subscribes to. Execution will continue
    until a None value is written to the channel.

    ```python
    from langgraph.channels import EphemeralValue
    from langgraph.pregel import Pregel, NodeBuilder, ChannelWriteEntry

    example_node = (
        NodeBuilder()
        .subscribe_only("value")
        .do(lambda x: x + x if len(x) < 10 else None)
        .write_to(ChannelWriteEntry(channel="value", skip_none=True))
    )

    app = Pregel(
        nodes={"example_node": example_node},
        channels={
            "value": EphemeralValue(str),
        },
        input_channels=["value"],
        output_channels=["value"],
    )

    app.invoke({"value": "a"})
    ```

    ```con
    {'value': 'aaaaaaaaaaaaaaaa'}
    ```
dict[str, PregelNode]nodesz)dict[str, BaseChannel | ManagedValueSpec]r   valuesr   stream_modeFr   stream_eagerstr | Sequence[str]output_channelsNstr | Sequence[str] | Nonestream_channelsAll | Sequence[str]interrupt_after_nodesinterrupt_before_nodesinput_channelsfloat | Nonestep_timeoutdebugrz   checkpointerBaseStore | NonestoreBaseCache | Nonecacher   zSequence[RetryPolicy]r   r   r   type[ContextT] | Nonecontext_schemaRunnableConfig | Noneconfig	LangGraphr   r   Mapping[str, Sequence[str]]trigger_to_nodesT)auto_validater   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r   c          	        UR                  S[        5      =n[        La4  [        R                  " S[        SS9  Uc  [        [        [           U5      nUR                  5        VVs0 s H.  u  nnU[        U[        5      (       a  UR                  5       OU_M0     snnU l        U=(       d    0 U l        [        U R                  ;   a9  [        U R                  [           [        5      (       d  [!        S[         S35      e[        ["        SS9U R                  [        '   X@l        XPl        X`l        Xpl        Xl        Xl        Xl        Xl        Ub  UO	[5        5       U l        Xl        Xl        Xl        [        U[>        5      (       a  U4OUU l         UU l!        UU l"        UU l#        U=(       d    0 U l$        UU l%        U(       a  U RM                  5         g g s  snnf )	Nconfig_typezU`config_type` is deprecated and will be removed. Please use `context_schema` instead.   category
stacklevelz	Channel 'z.' is reserved and cannot be used in the graph.F)
accumulate)'getrL   warningswarnr   r   typer   r   r   r   r   r   r   rD   rO   r   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   ri   r   r   r  r  r  r   validate)r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r   deprecated_kwargsr	  r   r   s                             r   r   Pregel.__init__s  s   6 -00HHK MMg4 %!%d8nk!B KP++-
JW$!QAJq+66qwwyA=-

 !BDMM!*T]]55I5*Q*QE7"PQ  $)%#@DMM% &(..%:"&<#,(#/UY[
(

),DD\O, 	 ), 0 6B	MMO =
s   '5Gxrayc                  U(       aS  U R                  5        VVs0 s H5  u  p4X4R                  U[        U[        5      (       d  US::  a  UOUS-
  S9_M7     nnnO0 n[	        [        U R                  U5      U R                  U R                  U R                  U R                  U R                  U R                  U R                  US9	$ s  snnf ):Return a drawable representation of the computation graph.r      r  r   specsr   r   r   r  r   	subgraphs)get_subgraphs	get_graphr   r   ra   r)   r  r   r   r   r   r   r  r   )r   r  r  r   r   r  s         r   r  Pregel.get_graph  s    
  !..0
 1DA	 ;;!+D$!7!7419$QR(    1  I I$++v.**--.."&"<"<#'#>#>!22**

 
	
s   <Cc                 ^^#    T(       a$  U R                  5        VVs0 s Sh  vN u  p4X4_M  0 n[        [        U R                  T5      U R                  U R                  U R                  U R                  U R                  U R                  U R                  US9	$  Nw
 Os  snnf nnn[        U[        R                  " UU4S jUR	                  5        5       6 I Sh  vN  5       VVs0 s H  u  p4X4_M	     Os  snnf nnnN7f)r  Nc              3     >#    U  H5  nUR                  T[        T[        5      (       d  TS ::  a  TOTS-
  S9v   M7     g7f)r   r  r  N)
aget_graphr   r   )r   pr  r  s     r   r   $Pregel.aget_graph.<locals>.<genexpr>  sL       &9 LL &#-dD#9#9TQY &*%)AX	 )  &9s   =A r  )aget_subgraphszipasynciogatherr   ra   r)   r  r   r   r   r   r   r  r   )r   r  r  r   r   
subpregelsr  s    ``    r   r#  Pregel.aget_graph  s      '+':':'<5 5#q( I$++v.**--.."&"<"<#'#>#>!22**

 
	
/5 5J 5
  !.. &0%6%6%8
 
 
DA I IsN   DB!BBBB!A-DBB! ?DC"
 D,C;:Dc                V    [        U 5      U R                  5       R                  5       S.$ )z0Mime bundle used by Jupyter to display the graph)z
text/plainz	image/png)reprr  draw_mermaid_png)r   r   s     r   _repr_mimebundle_Pregel._repr_mimebundle_   s(     t*)::<
 	
r   c                    U R                   R                  5        VVs0 s H  u  p#US:w  d  M  X#_M     nnnUR                  U=(       d    0 5        U R                  " S0 UD6$ s  snnf )N__orig_class__r   )__dict__r   r   	__class__)r   r   r   r   attrss        r   copyPregel.copy  s[    "&--"5"5"7Q"7$!1@P;P"7QV\r"~~&&& Rs
   A#A#c                n    U R                  S[        U R                  U[        [        U5      5      05      $ )z:Create a copy of the Pregel object with an updated config.r  )r6  r)   r  r   r   )r   r  r   s      r   with_configPregel.with_config  s/    yy}T[[&$~v:VWX
 	
r   c                   [        U R                  U R                  R                  5        VVs0 s H  u  p[	        U[
        5      (       d  M  X_M      snnU R                  R                  5        VVs0 s H  u  p[	        U[
        5      (       a  M  X_M      snnU R                  U R                  U R                  U R                  U R                  5        [        U R                  5      U l        U $ s  snnf s  snnf r   )rl   r   r   r   r   rN   r   r   r   r   r   _trigger_to_nodesr  )r   r   r   s      r   r  Pregel.validate  s    JJ"mm113R3daz![7QTQT3R"mm113V3da:a;UTQT3V    &&''		
 !2$** = SVs   C3C33C9C9\`config_schema` is deprecated. Use `get_context_jsonschema` for the relevant schema instead.r  includec                  [         R                  " S[        SS9  U=(       d    / n0 U R                  (       a  SU R                  S 40O0 E[	        [
        5      R                  5        VVVs0 s H(  u  p#X! Vs/ s H  oDS:w  d  M
  UPM     sn;   d  M$  X#S 4_M*     snnnEn[        U R                  S5      US9$ s  snf s  snnnf )Nr>  r
  r  configurableConfigfield_definitions)	r  r  r   r  r   r   r   rE   get_name)r   rA  
field_name
field_typeifieldss         r   config_schemaPregel.config_schema   s    
 	j0	
 -R
 &&  $"5"5t!<=	
 /=^.L.R.R.T.T*JW!LW^8K!W!LL /
...T
 DMM(3vNN "Ms$   +B>
7	B9B9
B>
B>
9B>
L`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.c               "   [         R                  " S[        SS9  [         R                  " 5          [         R                  " S[        S9  U R                  US9nS S S 5        UR                  5       $ ! , (       d  f       WR                  5       $ = f)NrN  r
  r  ignorer?  r@  )r  r  r   catch_warningsfilterwarningsrL  model_json_schema)r   rA  schemas      r   get_config_jsonschemaPregel.get_config_jsonschema:  s{     	Z0	
 $$&##H7RS'''8F ' '')) '& ''))s   )A11
Bc                   U R                   =nc  g [        U5      (       a%  [        U[        5      (       a  UR	                  5       $ [        U5      (       d  [        U5      (       a  [        U5      R                  5       $ [        SU S35      e)NzInvalid context schema type: z.. Must be a BaseModel, TypedDict or dataclass.)
r  r   
issubclassr"   rS  r'   r   r#   json_schemar   )r   r  s     r   get_context_jsonschemaPregel.get_context_jsonschemaL  s    "111N:>""z.)'L'L!3355.))\.-I-I~.::<<//??mn r   c                    [        U R                  [        5      (       a;  U R                  U R                     n[        U[        5      (       a  UR
                  $ g g r   )r   r   r   r   rN   
UpdateTyper   s     r   	InputTypePregel.InputTypeY  sL    d))3//mmD$7$78G';//))) 0 0r   c           
       > [        U R                  U5      n[        U R                  [        5      (       a  [
        TU ]  U5      $ [        U R                  S5      U R                  =(       d    U R                  R                  5        Vs0 s H@  nU R                  U   =n(       d  M  [        U[        5      (       d  M2  X#R                  S 4_MB     snS9$ s  snf )Nr   rE  )r)   r  r   r   r   superget_input_schemarE   rG  r   keysrN   r]  r   r  r   r   r4  s       r   rb  Pregel.get_input_schema`  s    t{{F3d))3//7+F33g& "00HDMM4F4F4HH#H!]]1--- ,3=a3M ,Ad++H# #s   
C
(C
?C
c                D    U R                  U5      nUR                  5       $ r   )rb  rS  r   r  rT  s      r   get_input_jsonschemaPregel.get_input_jsonscheman  s#     &&v.''))r   c                    [        U R                  [        5      (       a;  U R                  U R                     n[        U[        5      (       a  UR
                  $ g g r   )r   r   r   r   rN   	ValueTyper   s     r   
OutputTypePregel.OutputTypet  sL    d**C00mmD$8$89G';//((( 0 1r   c           
     t  > [        U R                  U5      n[        U R                  [        5      (       a  [
        TU ]  U5      $ [        U R                  S5      U R                   Vs0 s H@  nU R                  U   =n(       d  M  [        U[        5      (       d  M2  X#R                  S 4_MB     snS9$ s  snf )Nr   rE  )r)   r  r   r   r   ra  get_output_schemarE   rG  r   rN   rk  rd  s       r   ro  Pregel.get_output_schema{  s     t{{F3d**C007,V44h' "11#1!]]1--- +3=a3M +AT**1# #s   )B5
B5
B5
c                D    U R                  U5      nUR                  5       $ r   )ro  rS  rg  s      r   get_output_jsonschemaPregel.get_output_jsonschema  s#     ''/''))r   c                N    U R                   n[        U[        5      (       a  U/$ U$ r   )stream_channels_asisr   r   )r   r   s     r   stream_channels_listPregel.stream_channels_list  s,    33!+OS!A!A_	
GV	
r   c                    U R                   =(       dA    U R                   Vs/ s H)  n[        U R                  U   [        5      (       d  M'  UPM+     sn$ s  snf r   )r   r   r   rN   )r   r   s     r   ru  Pregel.stream_channels_asis  sG    ## 
}}(
$!
4==3C[(QA}(
 	
 (
s   &AA	namespacerecursec             #    ^#    U R                   R                  5        H  u  mnUb  UR                  T5      (       d  M!  UR                  (       a  UR                  S   OSnU(       d  ML  TU:X  a  TU4v     gUc  TU4v   U(       d  Ml  [	        U[
        5      (       d  M  Ub  U[        T5      S-   S nU4S jUR                  XS9 5        Sh  vN   M     g N	7f)  Get the subgraphs of the graph.

Args:
    namespace: The namespace to filter the subgraphs by.
    recurse: Whether to recurse into the subgraphs.
        If `False`, only the immediate subgraphs will be returned.

Returns:
    An iterator of the `(namespace, subgraph)` pairs.
Nr   r  c              3  D   >#    U  H  u  pT [          U 3U4v   M     g 7fr   )rA   )r   nsr   s      r   r   'Pregel.get_subgraphs.<locals>.<genexpr>  s0       %DA !6&!-q1%s    rz  )r   r   
startswithr  r   r   lenr  )r   r{  r|  r   graphr   s        @r   r  Pregel.get_subgraphs  s      ****,JD$$ ++D11 *.DNN1%TE u9$+%$+%7z%88 ,$-c$i!mo$>	 $)$7$7&/ %8 %   ' -&s$   A#C*C
C!0CC
Cc              H   #    U R                  XS9 H  u  p4X447v   M     g7f)r~  rz  N)r  )r   r{  r|  r   r   s        r   r&  Pregel.aget_subgraphs  s*      ,,y,RJD* Ss    "c                    US   S:  aZ  UR                  S5      (       aC  UR                  S5      nX!S   [        '   [        US   R	                  5       5      US   [        '   ggg)z1Migrate a saved checkpoint to new channel layout.r      pending_sendschannel_valueschannel_versionsN)r  poprD   maxr   )r   
checkpointr  s      r   _migrate_checkpointPregel._migrate_checkpoint  sh    c?Q:>>/#B#B(2(GM2?'(/47-.5575J)*51 $Cr   c                   U(       d  [        0 SUS S S SSS9$ U R                  UR                  5        UR                  R	                  SS5      S-   nUS-   n[        U R                  UR                  5      u  px[        UR                  UR                  =(       d    / U R                  UUUR                  UUSU R                  [        U R                  [        5      (       a  U R                  OS S S9n	[        U R!                  5       5      n
UR                  ["           R	                  [$        S	5      n0 nU	R'                  5        H  nUR(                  U
;  a  M  UR(                   [*         UR,                   3nU(       a  U [.         U 3nU(       d4  ["        S
UR                  ["           S
   [$        U00nXUR,                  '   M  ["        [0        US
UR                  ["           S
   [$        U00nXR(                     R3                  USS9XR,                  '   M     UR                  =(       d    /  Vs/ s H  oS   [4        :X  d  M  USS  PM     sn=n(       a4  [7        UR                  U[9        S[:        U/ 5      /S U R<                  5        U(       a  UR                  (       a  UR                   HA  u  nnnU[>        [@        4;   a  M  UU	;  a  M!  U	U   RB                  RE                  UU45        MC     U	R'                  5        Vs/ s H  nURB                  (       d  M  UPM     sn=n(       a#  [7        UR                  UUS U R<                  5        [G        U	R'                  5       UR                  UU RH                  5      n[        [K        XpRH                  5      [M        S U	R'                  5        5       5      [O        UR                  UR                  5      UR                  UR                  S   [O        URP                  UR                  5      U[M        U VVs/ s H  oRR                    H  nUPM     M     snn5      5      $ s  snf s  snf s  snnf )Nr   r   nextr  r   
created_atparent_configtasks
interruptsstepr  r
  Tfor_executionr   r   manager 	thread_idr  r   c              3  ^   #    U  H#  oR                   (       a  M  UR                  v   M%     g 7fr   writesr   r   ts     r   r   1Pregel._prepare_state_snapshot.<locals>.<genexpr>L       F"5QXX&!&&"5   --ts)*r   r  r  r   r  r]   r   r[   pending_writesr   r  r   r   r   r   dictr  r/   r2   r   r   r@   idrA   r3   	get_staterB   rY   rW   r>   r  r=   r?   r  r   rr   ru  rc   tupler*   r  r  )r   r  savedr|  apply_pending_writesr  stopr   managed
next_tasksr  	parent_nstask_statestasktask_nswnull_writestidr   r   r  r  tasks_with_writesrJ  s                           r   _prepare_state_snapshotPregel._prepare_state_snapshot  s     "	 	 	  !1!12~~!!&"-1ax4MM

 (  &BJJLL** d//1DEE !!!

& ++-.	LL&**+CRH	AC%%'Dyy	)F8DGG95G&Kxy9 #U\\$%7%D0' (.DGG$ /#U\\$%7%D0' (1';'E'Ed (F (GG$3 (< !//525
5a19MEAabE5
 
; 
   !"e["=>%%  E$8$8"11	Q	**j(3&&--q!f5 2 %/$5$5$7D$7q188$7DDuD$$htT=R=R +  %%	
 ($=$=>F*"3"3"5FF u~~>NNT" !4!4ennE!2L!2OOq1O1!2LM	
 		
9
" E& Ms   5Q		QQ$Q!Qc                
	  #    U(       d  [        0 SUS S S SSS9$ U R                  UR                  5        UR                  R	                  SS5      S-   nUS-   n[        U R                  UR                  5      u  px[        UR                  UR                  =(       d    / U R                  UUUR                  UUSU R                  [        U R                  [        5      (       a  U R                  OS S S9n	U R                  5        V
Vs0 s S h  vN u  pX_M   N

 Os  snn
f nn
nUR                  [            R	                  ["        S	5      n0 nU	R%                  5        H  nUR&                  U;  a  M  UR&                   [(         UR*                   3nU(       a  U [,         U 3nU(       d4  [         S
UR                  [            S
   ["        U00nXUR*                  '   M  [         [.        US
UR                  [            S
   ["        U00nXR&                     R1                  USS9I S h  vN  XR*                  '   M     UR                  =(       d    /  Vs/ s H  nUS   [2        :X  d  M  USS  PM     Os  snf sn=n(       a4  [5        UR                  U[7        S[8        U/ 5      /S U R:                  5        U(       a  UR                  (       a  UR                   HA  u  nnnU[<        [>        4;   a  M  UU	;  a  M!  U	U   R@                  RC                  UU45        MC     U	R%                  5        Vs/ s H  nUR@                  (       d  M  UPM     Os  snf sn=n(       a#  [5        UR                  UUS U R:                  5        [E        U	R%                  5       UR                  UU RF                  5      n[        [I        XpRF                  5      [K        S U	R%                  5        5       5      [M        UR                  UR                  5      UR                  UR                  S   [M        URN                  UR                  5      U[K        U VVs/ s H  oRP                    H  nUPM     M     Os  snnf snn5      5      $ 7f)Nr   r  r  r  r  r
  Tr  r  r  r  r   c              3  ^   #    U  H#  oR                   (       a  M  UR                  v   M%     g 7fr   r  r  s     r   r   2Pregel._aprepare_state_snapshot.<locals>.<genexpr>  r  r  r  ))r   r  r  r   r  r]   r   r[   r  r   r  r   r   r   r   r&  r/   r2   r   r   r@   r  rA   r3   
aget_staterB   rY   rW   r>   r  r=   r?   r  r   rr   ru  rc   r  r*   r  r  )r   r  r  r|  r  r  r  r   r  r  r  gr  r  r  r  r  r  r  r  r   r   r  r  r  rJ  s                             r   _aprepare_state_snapshotPregel._aprepare_state_snapshotU  s      "	 	 	  !1!12~~!!&"-1ax4MM

 (  &BJJLL** d//1DEE !!!

& -1,?,?,ABBDAQTBB	BLL&**+CRH	AC%%'Dyy	)F8DGG95G&Kxy9 #U\\$%7%D0' (.DGG$ /#U\\$%7%D0' .7yy-A-L-Ld .M . ( (GG$3 (< !//525
5a19MEAabE5
 
; 
   !"e["=>%%  E$8$8"11	Q	**j(3&&--q!f5 2 %/$5$5$7D$7q188$7DDuD$$htT=R=R +  %%	
 ($=$=>F*"3"3"5FF u~~>NNT" !4!4ennE!2L!2OOq1O1!2LM	
 		
su   DRD
DDDDDDDR+H.,,RI7-	I76B?R5MMC=RQ10Rr  c               t   [        U5      [           R                  [        U R                  5      nU(       d  [        S5      eU[           R                  [        S5      =n(       ad  [        U[           ;  aS  [        U5      nU R                  USS9 H%  u  pgUR                  [        U[        U05      US9s  $    [        SU S35      eU R                  (       a  [        U R                  U5      OUnU R                  SL a?  [        [        U[           [           5      n[        U[        [        [        U5      005      nU[           [           n	[!        U	[        5      (       d  [        U	5      U[           [        '   UR#                  U5      n
U R%                  UU
U(       a  UOS[&        U[           ;  S	9$ )
#Get the current state of the graph.No checkpointer setr  Trz  r  	Subgraph 
 not foundNr|  r  )r(   r/   r  r3   r   r   r2   r-   r  r  r,   r  r)   r   r   r<   r   	get_tupler  r1   r   r  r  r   checkpoint_nsrecast_pregelnsr  r  s              r   r  Pregel.get_state  s    4A3H3N3R3R#T%6%64
 233 $D\--.FKKMK%VD\9)-8F!//&$/O	''&v0G/VW' (   P !9VHJ!?@@7;{{t{{F3$c6$<(@ABB" 8:Nr:RSTF 4L!56	)S))14YF4L-.&&v.++$-L4!9!M	 , 
 	
r   c                 #    [        U5      [           R                  [        U R                  5      nU(       d  [        S5      eU[           R                  [        S5      =n(       aa  [        U[           ;  aP  [        U5      nU R                  USS9  Sh  vN u  pgUR                  [        U[        U05      US9I Sh  vN s  $ U R                  (       a  [        U R                  U5      OUnU R                  SL a?  [        [        U[           [           5      n[        U[        [        [        U5      005      nU[           [           n	[!        U	[        5      (       d  [        U	5      U[           [        '   UR#                  U5      I Sh  vN n
U R%                  UU
U(       a  UOS[&        U[           ;  S	9I Sh  vN $  GN0 GN	
 [        SU S35      e NK N7f)
r  r  r  Trz  Nr  r  r  r  )r(   r/   r  r3   r   r   r2   r-   r&  r  r,   r  r)   r   r   r<   r   
aget_tupler  r1   r  s              r   r  Pregel.aget_state  s     4A3H3N3R3R#T%6%64
 233 $D\--.FKKMK%VD\9)-8F#'#6#6QU#6#V Aia#..&v0G/VW' /    8<{{t{{F3$c6$<(@ABB" 8:Nr:RSTF 4L!56	)S))14YF4L-."--f5522$-L4!9!M	 3 
 
 	
'A $W !9VHJ!?@@ 6
s[   BG#GG	G&G#GCG#G0G#G!G#	GG#G#!G#filterbeforelimitc             #    #    [        U5      nU[           R                  [        U R                  5      nU(       d  [        S5      eU[           R                  [        S5      =n(       an  [        U[           ;  a]  [        U5      nU R                  USS9 H/  u  pU	R                  [        U[        U05      UUUS9 Sh  vN     g   [        SU S35      e[        U R                  U[        [        U[        [        U[           [           5      005      n[        UR                  XXBS	95       H!  n
U R!                  U
R                  U
5      v   M#     g N7f)
z*Get the history of the state of the graph.r  r  Trz  r  Nr  r  r  r  r  )r(   r/   r  r3   r   r   r2   r-   r  get_state_historyr,   r)   r  r<   r   r   r  )r   r  r  r  r  r   r  r  r  r  checkpoint_tuples              r   r  Pregel.get_state_history!  si     v&39$<3C3C#T%6%64
 233 $D\--.FKKMK%VD\9)-8F!//&$/O	!33&v0G/VW!!	 4     P !9VHJ!?@@KK,m(#fTl;O.P*Q	
 !%f5P!
 .. '')9 !
+s   B?EEBEc              &  #    [        U5      n[        U5      [           R                  [        U R                  5      nU(       d  [        S5      eU[           R                  [        S5      =n(       ai  [        U[           ;  aX  [        U5      nU R                  USS9  Sh  vN u  pU	R                  [        U[        U05      UUUS9  Sh  vN n
U
7v   M  [        U R                  U[        [        U[        [        U[           [           5      005      nUR                  XXBS	9 Vs/ s Sh  vN nUPM   N Nn
   g
 [        SU S35      e N
 Os  snf sn H+  nU R!                  UR                  U5      I Sh  vN  7v   M-     g7f)
z9Asynchronously get the history of the state of the graph.r  r  Trz  Nr  r  r  r  )r(   r/   r  r3   r   r   r2   r-   r&  aget_state_historyr,   r)   r  r<   r   alistr  )r   r  r  r  r  r   r  r  r  r  stater   r  s                r   r  Pregel.aget_state_historyT  s     v&3@3H3N3R3R#T%6%64
 233 $D\--.FKKMK%VD\9)-8F#'#6#6QU#6#V 
Aia#)#<#<&v0G/VW!!	 $= $  %  K
 KK,m(#fTl;O.P*Q	
 (--U . !
 !
 1
A  $  $W !9VHJ!?@@!
 !
 55 '')9   !
s   BF E$D>%E(%FEE EAF/E1E5E
6E9E>E EFEE+FFFc                  ^ ^	^
 [        U5      [           R                  [        T R                  5      m	T	(       d  [        S5      e[        U5      S:X  a  [        S5      e[        S U 5       5      (       a  [        S5      eU[           R                  [        S5      =n(       af  [        U[           ;  aU  [        U5      nT R                  USS9 H'  u  pVUR                  [        U[        T	05      U5      s  $    [        S	U S
35      e      SU	U
U 4S jjm
[        U[        [        U[           [           5      05      nU H  nT
" Xx5      nM     U$ )a  Apply updates to the graph state in bulk. Requires a checkpointer to be set.

Args:
    config: The config to apply the updates to.
    supersteps: A list of supersteps, each including a list of updates to apply sequentially to a graph state.
                Each update is a tuple of the form `(values, as_node, task_id)` where `task_id` is optional.

Raises:
    ValueError: If no checkpointer is set or no updates are provided.
    InvalidUpdateError: If an invalid update is provided.

Returns:
    RunnableConfig: The updated config.
r  r   No supersteps providedc              3  >   #    U  H  n[        U5      S :H  v   M     g7fr   Nr  r   us     r   r   +Pregel.bulk_update_state.<locals>.<genexpr>       /Jqs1v{J   No updates providedr  Trz  r  r  c                   > [        T/R                  U 5      nT-R                  U5      nUb  T/R                  UR                  5        U(       a  [        UR                  5      O	[        5       nU(       a  UR                  S   R                  5       O0 nU(       a  UR                  R                  SS5      OSn[        U[        U[           R                  [        S5      05      nU(       a  [        X#R                  [           5      n[        T/R                  U5      u  pUS   S S u  pU
Gc  U[        :X  Ga  [!        U5      S:  a  [#        S5      eUGbG  [%        UUR&                  =(       d    / T/R(                  UU	UR                  US-   US	-   S
T/R*                  T-S S9nUR&                  =(       d    /  Vs/ s H  nUS   [,        :X  d  M  USS  PM     sn=n(       a4  [/        UU[1        S[2        U/ 5      /T-R4                  T/R6                  5        UR&                  =(       d    /  H?  u  nnnU[8        [:        4;   a  M  X;  a  M   X   R<                  R?                  UU45        MA     [/        UUURA                  5       T-R4                  T/R6                  5        T-RC                  U[E        XHU5      SUS-   U(       a  UR                  R                  S0 5      O0 S.[G        UUS   5      5      n[I        UU(       a  UR                  5      $ S 5      $ U[2        :X  Gab  [!        U5      S:  a  [#        S5      e[K        [M        T/RN                  U
5      5      =n(       Ga	  [/        UU[1        S[2        U/ 5      /T-R4                  T/R6                  5        U(       a!  UR                  R                  S5      b  US-   OSnT-RC                  U[E        XHU5      SUU(       a  UR                  R                  S0 5      O0 S.[G        UUS   5      5      nT-RQ                  UU[S        [U        [W        US   5      [2        5      5      5        [I        UU(       a  UR                  5      $ S 5      $ [#        ST/RN                   35      eUS:X  Ga4  [!        U5      S:  a  [#        S5      eUc  [#        S5      e[E        US U5      nT-RC                  URX                  =(       d    [        UR                  [Z        S 05      USUS-   UR                  R                  S0 5      S.0 5      n[]        U
[^        5      (       Gaq  [!        U
5      S:  Gaa  [%        UUR&                  =(       d    / T/R(                  UU	UUS-   US-   S
T/R*                  T-S S9n[a        [^        5      n[a        [^        5      nURA                  5        H+  nUURb                     R?                  URd                  5        M-     U
 Hu  n[]        U[f        5      (       d  [#        SU S35      eUS S u  pUU   nUU   n[!        U5      nU[!        U5      :  a  UU   OS nUU   R?                  [i        XUS95        Mw     T." [I        UUR                  5      URA                  5        VVs/ s H  nU  H  nUPM     M     snn5      $ [I        UUR                  5      $ [a        [J        5      nUGb  UR&                  Gb  [%        UUR&                  T/R(                  UU	UR                  US-   US	-   S
T/R*                  T-S S9nURA                  5        H+  n UU Rb                     R?                  U Rd                  5        M-     UR&                  =(       d    /  Vs/ s H  oS   [,        :X  d  M  USS  PM     sn=n(       a4  [/        UU[1        S[2        U/ 5      /T-R4                  T/R6                  5        UR&                   H?  u  nnnU[8        [:        4;   a  M  X;  a  M   X   R<                  R?                  UU45        MA     URA                  5        V s/ s H  n U R<                  (       d  M  U PM     sn =n!(       a#  [/        UUU!T-R4                  T/R6                  5        / n"[!        U5      S:X  GaQ  US   u  pnUc2  [!        T/R(                  5      S:X  a  [k        T/R(                  5      S   nOUcn  [m        S US   RA                  5        5       5      (       dF  []        T/RN                  [R        5      (       a&  T/RN                  T/R(                  ;   a  T/RN                  nObUc_  [o        U/4S jUS   Rq                  5        5       5      n#U#(       a2  [!        U#5      S:X  a	  U#S   S   nOU#S   S   U#S   S   :w  a  U#S   S   nUc  [#        S 5      eUT/R(                  ;  a  [#        S!U S"35      eU"R?                  XU45        OLU HF  u  pnUc  [#        S#5      eUT/R(                  ;  a  [#        S!U S"35      eU"R?                  XU45        MH     / n$/ n%U" GHW  u  pn&T/R(                  U   Rr                  n'U'(       d  [#        S!U S$35      e[K        5       n([1        SUU([:        /5      nUR                  U[K        5       5      n)U&=(       d<    U)(       a  U)Ru                  5       O$[S        [U        [W        US   5      [:        5      5      nU$R?                  U5        U%R?                  U5        [!        U'5      S:  a  [w        U'6 OU'S   n*U*Ry                  U
[{        UT/Rb                  S%-   [|        U(R~                  [        U[        [        [        [        S / USS UUS-   5      UU	U5      0S&95        GMZ     [        U%U$5       HU  u  nnUR<                   Vs/ s H  oS   [        :w  d  M  UPM     n+nU(       d  M9  U+(       d  MB  T-RQ                  UU+U5        MW     [/        UUU$T-R4                  T/R6                  5        [E        XHUS-   5      nT-RC                  UUSUS-   U(       a  UR                  R                  S0 5      O0 S.[G        XTS   5      5      n[        U%U$5       HM  u  nnUR<                   Vs/ s H  oS   [        :X  d  M  UPM     sn=n,(       d  M:  T-RQ                  UU,U5        MO     [I        UU(       a  UR                  5      $ S 5      $ s  snf s  snnf s  snf s  sn f s  snf s  snf )'Nr  r  r  r  r   r
  r  1Cannot apply multiple updates when clearing state   Tr  r   r   parentssourcer  r  4Cannot apply multiple updates when updating as inputinputr  Received no input writes for __copy__,Cannot copy checkpoint with multiple updates%Cannot copy a non-existent checkpointforkr  Invalid update item:  when copying checkpointr   as_nodetask_idc              3  V   #    U  H  nUR                  5         H  nUv   M	     M!     g 7fr   )r   )r   vvr   s      r   r   FPregel.bulk_update_state.<locals>.perform_superstep.<locals>.<genexpr>  s*      1BYY[ ( Bs   ')versions_seenc              3     >#    U  H4  u  pUTR                   ;   d  M  UR                  5         H  nX14v   M
     M6     g 7fr   r   r   r   r  seenr   r   s       r   r   r    C      /'JGA

?  "&A  "/ 'J   ?"?!Ambiguous update, specify as_nodeNode  does not exist2as_node is required when applying multiple updates has no writersUpdateStaterun_namerC  )Gr(   r  r  r  r  r^   r`   r6  r   r  r,   r2   r/   r]   r   rQ   r  rT   r[   r  r   r   rB   rY   rW   r>   get_next_versionr  r=   r?   r  r   r   putr_   rk   r*   r   rb   r   
put_writesr   r   r   r  r1   r   r   r   r   r  r   r   r  anysortedr   flat_writerspopleftr   invoker+   r9   r   r;   r6   r   rZ   rX   r'  rC   )0input_configupdatesr  r  r  checkpoint_previous_versionsr  checkpoint_configr   r  r   r   r  r  r  r  r   r   next_configinput_writes	next_stepnext_checkpointtasks_group_byuser_group_byr  item
user_grouptasks_group
target_idxr  lstnode_to_task_idsr  r  valid_updateslast_seen_by_node	run_tasksrun_task_idsprovided_task_idr   r  prepared_task_idsrunchannel_writespush_writesr   perform_superstepr   s0                                                r   r6  3Pregel.bulk_update_state.<locals>.perform_superstep  s    #4;;=F **62E (()9)9:5: 0 01@P@R  @E  !3499;" ) 6;5>>%%fb1D 2,fTl.>.>0"/! $6v||D?Q$R! 8!H &aj!nOF ~'S.w<!#,K  $!3",,2

 qq&*"jj%1 $"J" "'!5!5!;!;'!;AQ4</ !"!;' { 
 %&$-b%bIJ(99 11 &+%9%9%?R%?	Q	 22$0$"..55q!f= &@ !" "))+$55-- +..%%jDA"* $qHM5>>#5#5i#DSU
 -4"#56 ,5 >B 
 %w<!#,N  $)43F3F)O#PP<P " )"e\2FG$55-- !U^^%7%7%?%K q 
 #/"2"2))*	J&-$-$ (-~~'9'9)R'H!# 18&'9:#K" !++#$E$z$'7"8%@A 0#uU^^ BF  -78K8K7LM 
 *$w<!#,F  =,-TUU"3Jd"K +..'' )'?&F $"( $q#(>>#5#5i#D
   fd++Fa!3',,2

 #qq&*"jj%1 $"J &1%6NBMdBSM * 1 1 3&tyy188A !4 !')$99"4"7v=U V#  +/r(%27%;
&4W&=%(_
  *C,<< (
3!%   &g.55'vPWX% !', -,[%..I)6)=)=)?P)?#CDC)?P 
 ,KHH 7B%6H U%9%9%E/((JJLL1H1H"&**!- 
 $**,A$QVV,33ADD9 -
 $)#7#7#=2#=##=a1AUEAabE#=# ;  !" )"e["EF$55-- "'!5!5ICAUI.. , O**111a&9 "6 )3(9(9(;H(;1qxxQ(;HH5H " $55-- RTM7|q +21:(?s4::!';#DJJ/2G_S 1(9@@B1 . . #4#6#6<< //4::="&"5"5_(. /'1/'B'H'H'J/ )% )01Q6&7&:1&=G.r2159J29Nq9QQ&7&;A&>G?,-PQQ$**,,uWI_-MNN$$gw%?@07,FW0P  djj005	1QRR!(('7)CD 18 13I&(L5B1!1**W-::,uWI_-MNN16'GVi[I %5$8$8%'$J!* ( &--/U4
4(8#99EF 
   &##G,47L14D&0'RS*

 !%]!: ,V]].+W * +$($&$+$&$($($(1H!" !) ' $.	&) 6C` "%\9!=-1[[!I[aDDL![!I5^^ ++,=~wW	 "> --%% +:JJ&**!& 1HDIu~~11)R@r
 )0=O2PK "%\9!=.2kk"JkqTT\1k"JJ;J ++KgN ">
 (uU^^WWRVWWG'\ Q:#" IT "J4 #KsB   9s1	s1
s67s<	s<3tt0ttt%tr  r   r  zSequence[StateUpdate]r   r   )r(   r/   r  r3   r   r   r  r  r2   r-   r  bulk_update_stater,   r<   r   )r   r  
superstepsr  r  r  r  current_config	superstepr   r6  s   `        @@r   r9  Pregel.bulk_update_state  sn   ( 4A3H3N3R3R#T%6%64
 233z?a566/J///233 $D\--.FKKMK%VD\9)-8F!//&$/O	//&v0G/VW  P !9VHJ!?@@[	X([	X3H[	X[	X [	Xz ,)3vd|<P/Q+RS
 $I.~IN $r   c                  ^ ^	^
#    [        U5      [           R                  [        T R                  5      m
T
(       d  [        S5      e[        U5      S:X  a  [        S5      e[        S U 5       5      (       a  [        S5      eU[           R                  [        S5      =n(       ac  [        U[           ;  aR  [        U5      nT R                  USS9  S	h  vN u  pVUR                  [        U[        T
05      U5      I S	h  vN s  $       SU	U
U 4S jjm	[        U[        [        U[           [           5      05      nU H  nT	" Xx5      I S	h  vN nM     U$  N N\
 [        S
U S35      e N7f)a*  Asynchronously apply updates to the graph state in bulk. Requires a checkpointer to be set.

Args:
    config: The config to apply the updates to.
    supersteps: A list of supersteps, each including a list of updates to apply sequentially to a graph state.
                Each update is a tuple of the form `(values, as_node, task_id)` where `task_id` is optional.

Raises:
    ValueError: If no checkpointer is set or no updates are provided.
    InvalidUpdateError: If an invalid update is provided.

Returns:
    RunnableConfig: The updated config.
r  r   r  c              3  >   #    U  H  n[        U5      S :H  v   M     g7fr  r  r  s     r   r   ,Pregel.abulk_update_state.<locals>.<genexpr>{  r  r  r  r  Trz  Nr  r  c                  >#    [        T/R                  U 5      nT.R                  U5      I S h  vN nUb  T/R                  UR                  5        U(       a  [        UR                  5      O	[        5       nU(       a  UR                  S   R                  5       O0 nU(       a  UR                  R                  SS5      OSn[        U[        U[           R                  [        S5      05      nU(       a  [        X#R                  [           5      n[        T/R                  U5      u  pUS   S S u  pU
Gc  U[        :X  Ga  [!        U5      S:  a  [#        S5      eUGbG  [%        UUR&                  =(       d    / T/R(                  UU	UR                  US-   US	-   S
T/R*                  T.S S9nUR&                  =(       d    /  Vs/ s H  nUS   [,        :X  d  M  USS  PM     sn=n(       a4  [/        UU[1        S[2        U/ 5      /T.R4                  T/R6                  5        UR&                  =(       d    /  H?  u  nnnU[8        [:        4;   a  M  X;  a  M   X   R<                  R?                  UU45        MA     [/        UUURA                  5       T.R4                  T/R6                  5        T.RC                  U[E        XHU5      SUS-   U(       a  UR                  R                  S0 5      O0 S.[G        XTS   5      5      I S h  vN n[I        UU(       a  UR                  5      $ S 5      $ U[2        :X  Gar  [!        U5      S:  a  [#        S5      e[K        [M        T/RN                  U
5      5      =n(       Ga  [/        UU[1        S[2        U/ 5      /T.R4                  T/R6                  5        U(       a!  UR                  R                  S5      b  US-   OSnT.RC                  U[E        XHU5      SUU(       a  UR                  R                  S0 5      O0 S.[G        UUS   5      5      I S h  vN nT.RQ                  UU[S        [U        [W        US   5      [2        5      5      5      I S h  vN   [I        UU(       a  UR                  5      $ S 5      $ [#        ST/RN                   35      eUS:X  GaQ  [!        U5      S:  a  [#        S5      eUc  [#        S5      e[E        US U5      nT.RC                  URX                  =(       d    [        UR                  [Z        S 05      USUS-   UR                  R                  S0 5      S.0 5      I S h  vN n[]        U
[^        5      (       Gay  [!        U
5      S:  Gai  [%        UUR&                  =(       d    / T/R(                  UU	UUS-   US-   S
T/R*                  T.S S9n[a        [^        5      n[a        [^        5      nURA                  5        H+  nUURb                     R?                  URd                  5        M-     U
 Hu  n[]        U[f        5      (       d  [#        SU S35      eUS S u  pUU   nUU   n[!        U5      nU[!        U5      :  a  UU   OS nUU   R?                  [i        XUS95        Mw     T-" [I        UUR                  5      URA                  5        VVs/ s H  nU  H  nUPM     M     snn5      I S h  vN $ [I        UU(       a  UR                  5      $ S 5      $ [a        [J        5      nUGb  UR&                  Gb  [%        UUR&                  T/R(                  UU	UR                  US-   US	-   S
T/R*                  T.S S9nURA                  5        H+  n UU Rb                     R?                  U Rd                  5        M-     UR&                  =(       d    /  Vs/ s H  oS   [,        :X  d  M  USS  PM     sn=n(       a4  [/        UU[1        S[2        U/ 5      /T.R4                  T/R6                  5        UR&                   H?  u  nnnU[8        [:        4;   a  M  X;  a  M   X   R<                  R?                  UU45        MA     URA                  5        V s/ s H  n U R<                  (       d  M  U PM     sn =n!(       a#  [/        UUU!T.R4                  T/R6                  5        / n"[!        U5      S:X  Ga0  US   u  pnUc2  [!        T/R(                  5      S:X  a  [k        T/R(                  5      S   nOUcM  U(       dF  []        T/RN                  [R        5      (       a&  T/RN                  T/R(                  ;   a  T/RN                  nObUc_  [m        U/4S jUS   Ro                  5        5       5      n#U#(       a2  [!        U#5      S:X  a	  U#S   S   nOU#S   S   U#S   S   :w  a  U#S   S   nUc  [#        S5      eUT/R(                  ;  a  [#        S U S!35      eU"R?                  XU45        OLU HF  u  pnUc  [#        S"5      eUT/R(                  ;  a  [#        S U S!35      eU"R?                  XU45        MH     / n$/ n%U" GH_  u  pn&T/R(                  U   Rp                  n'U'(       d  [#        S U S#35      e[K        5       n([1        SUU([:        /5      nUR                  U[K        5       5      n)U&=(       d<    U)(       a  U)Rs                  5       O$[S        [U        [W        US   5      [:        5      5      nU$R?                  U5        U%R?                  U5        [!        U'5      S:  a  [u        U'6 OU'S   n*U*Rw                  U
[y        UT/Rb                  S$-   [z        U(R|                  [~        U[        [        [        [        S / USS UUS-   5      UU	U5      0S%95      I S h  vN   GMb     [        U%U$5       H]  u  nnUR<                   Vs/ s H  oS   [        :w  d  M  UPM     n+nU(       d  M9  U+(       d  MB  T.RQ                  UU+U5      I S h  vN   M_     [/        UUU$T.R4                  T/R6                  5        [E        XHUS-   5      nT.RC                  UUSUS-   U(       a  UR                  R                  S0 5      O0 S.[G        XTS   5      5      I S h  vN n[        U%U$5       HU  u  nnUR<                   Vs/ s H  oS   [        :X  d  M  UPM     sn=n,(       d  M:  T.RQ                  UU,U5      I S h  vN   MW     [I        UU(       a  UR                  5      $ S 5      $  GN s  snf  G
N7 G	N GN GNs  snnf  GNts  snf s  sn f  GNs  snf  GND Ns  snf  Nd7f)&Nr  r  r  r  r   r
  r  r  r  Tr  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  c              3     >#    U  H4  u  pUTR                   ;   d  M  UR                  5         H  nX14v   M
     M6     g 7fr   r  r  s       r   r   HPregel.abulk_update_state.<locals>.aperform_superstep.<locals>.<genexpr>  r
  r  r  r  r  r  r  r  r  r  r  )Fr(   r  r  r  r  r^   r`   r6  r   r  r,   r2   r/   r]   r   rQ   r  rT   r[   r  r   r   rB   rY   rW   r>   r  r  r=   r?   r  r   r   aputr_   rk   r*   r   rb   r   aput_writesr   r   r   r  r1   r   r   r   r   r  r   r   r  r  r   r  r  r   ainvoker+   r9   r   r;   r6   r   rZ   rX   r'  rC   )0r  r  r  r  r  r  r  r   r   r  r   r   r  r  r  r  r   r   r!  r"  r#  r$  r%  r&  r  r'  r(  r)  r*  r  r+  r,  r  r  r-  r.  r/  r0  r1  r   r  r2  r3  r4  r5  aperform_superstepr   r   s0                                                r   rG  5Pregel.abulk_update_state.<locals>.aperform_superstep  sX     #4;;=F&11&99E (()9)9:5: 0 01@P@R  @E  !3499;" ) 6;5>>%%fb1D 2,fTl.>.>0"/! $6v||D?Q$R! 8!H &aj!nOF~'S.w<!#,K  $!3",,2

 qq&*"jj%1 $"J" "'!5!5!;!;'!;AQ4</ !"!;' { 
 %&$-b%bIJ(99 11 &+%9%9%?R%?	Q	 22$0$"..55q!f= &@ !" "))+$55-- %1$5$5%%jDA"* $qHM5>>#5#5i#DSU
 -4AS6T%  ,5 >B 
 %w<!#,N  $)43F3F)O#PP<P " )"e\2FG$55-- !U^^%7%7%?%K q 
 )5(9(9))*	J&-$-$ (-~~'9'9)R'H!# 18&'9:) #K" '22#$E$z$'7"8%@A   0#uU^^ BF  -78K8K7LM 
 *$w<!#,F  =,-TUU"3Jd"K %1$5$5'' )'?&F $"( $q#(>>#5#5i#D
 %   fd++Fa!3',,2

 #qq&*"jj%1 $"J &1%6NBMdBSM * 1 1 3&tyy188A !4 !')$99"4"7v=U V#  +/r(%27%;
&4W&=%(_
  *C,<< (
3!%   &g.55'vPWX# !'* "4,[%..I)6)=)=)?P)?#CDC)?P"  
 ,5 >B  7B%6H U%9%9%E/((JJLL1H1H"&**!- 
 $**,A$QVV,33ADD9 -
 $)#7#7#=2#=##=a1AUEAabE#=# ;  !" )"e["EF$55-- "'!5!5ICAUI.. , O**111a&9 "6 )3(9(9(;H(;1qxxQ(;HH5H " $55-- RTM7|q +21:(?s4::!';#DJJ/2G_U"4#6#6<< //4::="&"5"5_(. /'1/'B'H'H'J/ )% )01Q6&7&:1&=G.r2159J29Nq9QQ&7&;A&>G?,-PQQ$**,,uWI_-MNN$$gw%?@07,FW0P  djj005	1QRR!(('7)CD 18 13I&(L5B1!1**W-::,uWI_-MNN16'GVi[I %5$8$8%'$J!* ( &--/U4
4(8#99EF 
   &##G,47L14D&0'RS*kk !%]!: ,V]].+W * +$($&$+$&$($($(1H!" !) ' $.	&  ) 6C` "%\9!=-1[[!I[aDDL![!I5^^&22)>7  	 "> --%% +:JJ , 1 1!& 1HDIu~~11)R@r
 )0=O2P! K "%\9!=.2kk"JkqTT\1k"JJ;J&22;WUUU "> (uU^^WWRVWWc :b'8L#"6| QB#  IP< "J #KUs2  +u)t.Fu)t1	t1!Du)?t6 D&u)&t9'=u)$t<%C u)t?E-u)3u	u)uC u)5u		uBu)1u
uLu)+u,)u)u)u/u):u)u)uBu)!u "$u)u"u" u),u)u',u)1u)9u)<u)?u)u)u)u) u)"u)r8  )r(   r/   r  r3   r   r   r  r  r2   r-   r&  abulk_update_stater,   r<   r   )r   r  r:  r  r  r  r  r;  r<  rG  r   s   `        @@r   rI  Pregel.abulk_update_state^  s    ( 4A3H3N3R3R#T%6%64
 233z?a566/J///233 $D\--.FKKMK%VD\9)-8F#'#6#6QU#6#V Aia#66&v0G/VW  V	X(V	X3HV	XV	X V	Xp ,)3vd|<P/Q+RS
 $I#5n#PPN $KA $W !9VHJ!?@@| QsI   CE5E#EE#(E5E!AE5E3
E5E#!E5#E5c                >    U R                  U[        X#U5      //5      $ )zUpdate the state of the graph with the given values, as if they came from
node `as_node`. If `as_node` is not provided, it will be set to the last node
that updated the state, if not ambiguous.
)r9  r   r   r  r   r   r  s        r   update_statePregel.update_state,	  s$     %%fFW0U/V.WXXr   c                Z   #    U R                  U[        X#U5      //5      I Sh  vN $  N7f)zAsynchronously update the state of the graph with the given values, as if they came from
node `as_node`. If `as_node` is not provided, it will be set to the last node
that updated the state, if not ambiguous.
N)rI  r   rL  s        r   aupdate_statePregel.aupdate_state9	  s6      ,,k&7;<=
 
 	
 
s   "+)+)
durabilityc                  US   S:  a  [        S5      eUc  U R                  nO[        X@R                  5        U=(       d    U R                  nU=(       d    U R
                  n[        U[        5      (       d  U1nO[        U5      n[        U[        5      (       a  UR                  U5        OUR                  U5        U R                  SL a  S n	OU[        UR                  [        0 5      ;   a  U[           [           n	O&U R                  SL a  [!        S5      eU R                  n	U	(       a%  UR                  [        5      (       d  [        S5      e["        UR                  [        0 5      ;   a  U[           ["           R$                  n
OU R$                  n
[&        UR                  [        0 5      ;   a  U[           [&           nOU R(                  nUc*  UR                  [        0 5      R                  [*        S5      nUUUUU	U
UU4$ )	Nrecursion_limitr  z"recursion_limit must be at least 1FTz1checkpointer=True cannot be used for root graphs.zoCheckpointer requires one or more of the following 'configurable' keys: thread_id, checkpoint_ns, checkpoint_idasync)r   ru  rm   r   r   r   r   r   setr   addr   r   r3   r  r/   RuntimeErrorr8   r   r0   r   r4   )r   r  r   
print_modeoutput_keysinterrupt_beforeinterrupt_afterrR  stream_modesr   r   r   s               r   	_defaultsPregel._defaultsH	  s   ( #$q(ABB33K+}}5+Jt/J/J)GT-G-G+t,,'=L{+Lj#&&Z(
+%7;L$

4(<<!$<(?@L$&RSS,,L

4 0 0@  D"!55&,Tl3E&F&L&LEJJEvzz$33&,Tl3C&DEJJED"-112GQJ	
 		
r   )	contextr   rY  rZ  r[  r\  rR  r  r   c       	      +    ^#^$^%#    UR                  S5      =nb3  [        R                  " S[        SS9  U	b  [	        S5      eU(       a  SOSn	Uc/  Ub   [
        UR                  [        0 5      ;   a  S	OU R                  nU(       d  U R                  (       a  S
S	/n[        5       m$[        U R                  U5      n[        U5      nUR                  SUUR                  SU R                  5       5      UR                  S5      S9n U R                  UUUUUUU	S9u  nnnnnnnnUc  U	b  [        R                  " S5        U R                   SL a7  [#        [$        U[           [&           5      n[)        U5      U[           [&        '   SU;   a  [#        [$        S-  U[           R                  [&        5      5      nUR*                  R-                  [/        T$R0                  U
U(       a  [3        UR5                  [6        5      5      OSS95        SU;   a	  S3U$4S jjnO1[8        U[           ;   a  U[           [:           R<                  nOS3S jnU	b  UU[           [>        '   [A        [C        U RD                  U5      UUSS9nU[           R                  [:        [F        5      nURI                  U5      nUU[           [:        '   [K        U40 S[M        T$R0                  U5      _SU_SU_SU_SU_SU RN                  _SU RP                  _SU_SU RR                  _S U RT                  _S!U_S"U_S#U_S$U_S%U RV                  _S&U RX                  _S'U RZ                  _S(U R\                  _6 m#[_        U[           R                  [`        [b        Rd                  " T#Rf                  5      5      [b        Rd                  " T#Rh                  5      U[           R                  [j        5      S)9nU
(       a$  T#Rl                  T#R                  [           [8        '   SnU Rn                  (       d  U
(       d  SU;   d  SU;   a;  Sm%T#Rp                  Rs                  T$Rt                  Rv                  5        S4U#U$U%4S* jjnT#Ry                  5       (       Ga  T#R{                  5        H(  nT#R}                  UR~                  UR                  SS+9  M*     URy                  T#R                  R                  5        Vs/ s H  nUR                  (       a  M  UPM     snU R                  UT#R                  S,9 H1  n [        XEU
T$R                   [        R                  5       Sh  vN   M3     T#R                  5         US-:X  a  T#R                  R                  5         T#Ry                  5       (       a  GM  SSS5        [        XEU
T$R                   [        R                  5       Sh  vN   T#R                  S.:X  a*  [        S/US0    S13[        R                  S29n![        U!5      eUR                  T#R                  5        gs  snf  N! , (       d  f       N= f Nr! [         a  n"UR                  U"5        e Sn"A"ff = f7f)5a[  Stream graph steps for a single input.

Args:
    input: The input to the graph.
    config: The configuration to use for the run.
    context: The static context to use for the run.
        !!! version-added "Added in version 0.6.0"
    stream_mode: The mode to stream output, defaults to `self.stream_mode`.
        Options are:

        - `"values"`: Emit all values in the state after each step, including interrupts.
            When used with functional API, values are emitted once at the end of the workflow.
        - `"updates"`: Emit only the node or task names and updates returned by the nodes or tasks after each step.
            If multiple updates are made in the same step (e.g. multiple nodes are run) then those updates are emitted separately.
        - `"custom"`: Emit custom data from inside nodes or tasks using `StreamWriter`.
        - `"messages"`: Emit LLM messages token-by-token together with metadata for any LLM invocations inside nodes or tasks.
            Will be emitted as 2-tuples `(LLM token, metadata)`.
        - `"checkpoints"`: Emit an event when a checkpoint is created, in the same format as returned by `get_state()`.
        - `"tasks"`: Emit events when tasks start and finish, including their results and errors.

        You can pass a list as the `stream_mode` parameter to stream multiple modes at once.
        The streamed outputs will be tuples of `(mode, data)`.

        See [LangGraph streaming guide](https://langchain-ai.github.io/langgraph/how-tos/streaming/) for more details.
    print_mode: Accepts the same values as `stream_mode`, but only prints the output to the console, for debugging purposes. Does not affect the output of the graph in any way.
    output_keys: The keys to stream, defaults to all non-context channels.
    interrupt_before: Nodes to interrupt before, defaults to all nodes in the graph.
    interrupt_after: Nodes to interrupt after, defaults to all nodes in the graph.
    durability: The durability mode for the graph execution, defaults to `"async"`.
        Options are:

        - `"sync"`: Changes are persisted synchronously before the next step starts.
        - `"async"`: Changes are persisted asynchronously while the next step executes.
        - `"exit"`: Changes are persisted only when the graph exits.
    subgraphs: Whether to stream events from inside subgraphs, defaults to False.
        If `True`, the events will be emitted as tuples `(namespace, data)`,
        or `(namespace, mode, data)` if `stream_mode` is a list,
        where `namespace` is a tuple with the path to the node where a subgraph is invoked,
        e.g. `("parent_node:<task_id>", "child_node:<task_id>")`.

        See [LangGraph streaming guide](https://langchain-ai.github.io/langgraph/how-tos/streaming/) for more details.

Yields:
    The output of each step in the graph. The output shape depends on the `stream_mode`.
checkpoint_duringNW`checkpoint_during` is deprecated and will be removed. Please use `durability` instead.r
  r  aCannot use both `checkpoint_during` and `durability` parameters. Please use `durability` instead.rU  exitr   r  r  run_idr   rf  r   rY  rZ  r[  r\  rR  ;`durability` has no effect when no checkpointer is present.Tmessagesr  customc                   > TR                  [        [        5       [           [           R                  [        5      S S 5      SU 45        g Nr  rl  )r  r  rP   r/   r2   splitrA   )r   streams    r   stream_writer$Pregel.stream.<locals>.stream_writer
  sL    JJ! *T 23K L R R$*!""%2!'
 %
r   c                    g r   r   r   s    r   rq  rr  &
      r   r`  r   rq  previousrp  r  r   r   r   r   r  rZ  
input_keysstream_keysr[  r\  r  rR  r  migrate_checkpointr   r   )submitr  node_finishedc                 r   > Tb  TR                  5       (       a  T R                  TR                  5      mT$ T$ r   )doner{  wait)looprp  waiters   r   
get_waiter!Pregel.stream.<locals>.get_waiterg
  s.    !>V[[]]%)[[%=F#)M#)Mr   cachedtimeoutr  schedule_tasksyncout_of_stepsRecursion limit of rT  r reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.message
error_coder   r   r   r   )r   zconcurrent.futures.Future[None])Tr  r  r  r   r   r;   r/   r   r   rG   r(   r  r   on_chain_startrG  r^  r   r   r   r2   r-   inheritable_handlersr   rf   r  r  ro  rA   r:   r8   rq  r4   rw   _coerce_contextr  rv   mergere   ru   r   r   r   ru  r  r  r   r   rj   r7   weakref
WeakMethodr{  r  r5   rp  r   stackcallback_countreleasetickmatch_cached_writesoutput_writesr  r  r  r   r   accept_push_outputqueueEmpty
after_tick_put_checkpoint_futresultstatusrU   rR   GRAPH_RECURSION_LIMITrS   on_chain_endoutputBaseExceptionon_chain_error)&r   r  r  r`  r   rY  rZ  r[  r\  rR  r  r   r   rb  callback_managerrun_managerr]  interrupt_before_interrupt_after_r   r   r   durability_r  ns_rq  runtimeparent_runtimerunnerr  r  r  r  msger  rp  r  s&                                      @@@r   rp  Pregel.stream	  s     z "(,?!@@MMMi4
 % w  %66J
 %*<

4QS@T*T %% 
 DJJ#X.Jt{{F3:6B&55J8::h'	 6 
l	 '%'!1 /%  	!  #
(>Q   D(#vd|,DEF9Mb9Qt56\)3:vd|'7'78P'QR0077)

!>A%		&(9":t <'  #fTl2 &t-? @ N N %6At23'(;(;WE+	G $D\--.@/RN$**73G/6F4L+,%fjj,?  	
  * jj mm (  .. !55 "3 !1 $ '  "&!6!6!" $(#;#;#$ "..%& "..'( %!$<++0'2D2DT[[2Q  '11$//B"(,"2"23K"L ;?;;DKK%&78SW
%% !\1</ @DF JJ''(=(=>* * iikk $ 8 8 :**477DKK*M !;#[[$(JJ$5$5$7H$7qqxx$7H $ 1 1#-&*&6&6	 )  $+'Y

EKK$   OO%"f,00779! iikk{^ FJJ   {{n,*-f5F.G-H IM M  )>> *#..$$T[[1; IO ^   	&&q)	sw   D Y)IY %FX2'X+
 X+
AX2X0AX21Y YAY *Y)+X22
Y <Y 
Y&Y!!Y&&Y)c       	         ^(^)^*#    UR                  S5      =nb3  [        R                  " S[        SS9  U	b  [	        S5      eU(       a  SOSn	Uc/  Ub   [
        UR                  [        0 5      ;   a  S	OU R                  nU(       d  U R                  (       a  S
S	/n[        5       m)[        R                  " 5       m([        [        [        /S4   [        T(R                   T)R"                  5      5      n[%        U R&                  U5      n[)        U5      nUR+                  SUUR                  SU R-                  5       5      UR                  S5      S9I Sh  vN n[.        b  [1        S UR2                   5       S5      OSn U R5                  UUUUUUU	S9u  nnnnnnnnUc  U	b  [        R                  " S5        U R6                  SL a7  [        [8        U[           [:           5      n[=        U5      U[           [:        '   SU;   av  [        [8        S-  U[           R                  [:        5      5      nUR>                  RA                  [C        UU
U(       a  [E        URG                  [H        5      5      OSS95        S7U(U)4S jjnSU;   a
  S7U(U)4S jjnO1[J        U[           ;   a  U[           [L           RN                  nOS7S jnU	b  UU[           [P        '   [S        [U        U RV                  U5      UUSS9nU[           R                  [L        [X        5      nUR[                  U5      nUU[           [L        '   []        U40 S[_        T)R"                  U5      _SU_SU_SU_SU_SU R`                  _S U Rb                  _S!U_S"U Rd                  _S#U Rf                  _S$U_S%U_S&U_S'U_S(U Rh                  _S)U Rj                  _S*U Rl                  _S+U Rn                  _6 ISh  vN n[q        U[           R                  [r        [t        Rv                  " URx                  5      5      [t        Rv                  " URz                  5      UU[           R                  [|        5      S,9nU
(       a$  [_        UU5      UR&                  [           [J        '   Sn Sn!U R~                  (       d  U
(       d  SU;   d  SU;   a  Sm*S8U(U)U*4S- jjn S9U)U*4S. jjn! UR                  5       (       a  UR                  5       I Sh  vN  H(  n"UR                  U"R                  U"R                  SS/9  M*     UR                  UR                  R                  5        V#s/ s H  n#U#R                  (       a  M  U#PM     sn#U R                  U UR                  S09  Sh  vN n$[        UUU
T)R                  [        R                  5       H  n%U%7v   M
     M>  U!b  U!" 5       I Sh  vN   SSS5      ISh  vN   [        UUU
T)R                  [        R                  5       H  n%U%7v   M
     WR                  S2:X  a*  [        S3US4    S53[        R                  S69n&[        U&5      eUR                  UR                  5      I Sh  vN   g GN& GN GNs  sn#f  N
 UR                  5         US1:X  a-  [        [        R                  UR                  5      I Sh  vN    UR                  5       (       a  GM  GN! GN! U!b  U!" 5       I Sh  vN    f f = f GN ! , ISh  vN  (       d  f       GN6= f N! [         a4  n'[        R                  " UR                  U'5      5      I Sh  vN    e Sn'A'ff = f7f):a
  Asynchronously stream graph steps for a single input.

Args:
    input: The input to the graph.
    config: The configuration to use for the run.
    context: The static context to use for the run.
        !!! version-added "Added in version 0.6.0"
    stream_mode: The mode to stream output, defaults to `self.stream_mode`.
        Options are:

        - `"values"`: Emit all values in the state after each step, including interrupts.
            When used with functional API, values are emitted once at the end of the workflow.
        - `"updates"`: Emit only the node or task names and updates returned by the nodes or tasks after each step.
            If multiple updates are made in the same step (e.g. multiple nodes are run) then those updates are emitted separately.
        - `"custom"`: Emit custom data from inside nodes or tasks using `StreamWriter`.
        - `"messages"`: Emit LLM messages token-by-token together with metadata for any LLM invocations inside nodes or tasks.
            Will be emitted as 2-tuples `(LLM token, metadata)`.
        - `"debug"`: Emit debug events with as much information as possible for each step.

        You can pass a list as the `stream_mode` parameter to stream multiple modes at once.
        The streamed outputs will be tuples of `(mode, data)`.

        See [LangGraph streaming guide](https://langchain-ai.github.io/langgraph/how-tos/streaming/) for more details.
    print_mode: Accepts the same values as `stream_mode`, but only prints the output to the console, for debugging purposes. Does not affect the output of the graph in any way.
    output_keys: The keys to stream, defaults to all non-context channels.
    interrupt_before: Nodes to interrupt before, defaults to all nodes in the graph.
    interrupt_after: Nodes to interrupt after, defaults to all nodes in the graph.
    durability: The durability mode for the graph execution, defaults to `"async"`.
        Options are:

        - `"sync"`: Changes are persisted synchronously before the next step starts.
        - `"async"`: Changes are persisted asynchronously while the next step executes.
        - `"exit"`: Changes are persisted only when the graph exits.
    subgraphs: Whether to stream events from inside subgraphs, defaults to False.
        If `True`, the events will be emitted as tuples `(namespace, data)`,
        or `(namespace, mode, data)` if `stream_mode` is a list,
        where `namespace` is a tuple with the path to the node where a subgraph is invoked,
        e.g. `("parent_node:<task_id>", "child_node:<task_id>")`.

        See [LangGraph streaming guide](https://langchain-ai.github.io/langgraph/how-tos/streaming/) for more details.

Yields:
    The output of each step in the graph. The output shape depends on the `stream_mode`.
rb  Nrc  r
  r  rd  rU  re  r   r  r  rf  rg  c              3     #    U  H5  n[        U[        5      (       d  M  [        U[        5      (       a  M1  S v   M7     g7f)TN)r   r   rf   )r   hs     r   r   !Pregel.astream.<locals>.<genexpr>
  s6      1!!%>?  'q*?@ D1s   ??	?Frh  ri  Trj  rk  c                   > TR                  TR                  [        [        5       [           [
           R                  [        5      S S 5      SU 45        g rn  call_soon_threadsafe
put_nowaitr  rP   r/   r2   ro  rA   r   aiolooprp  s    r   rq  %Pregel.astream.<locals>.stream_writer3  sT    ,,%%&L./GHNNvV #
 !r   rl  c                   > TR                  TR                  [        [        5       [           [
           R                  [        5      S S 5      SU 45        g rn  r  r  s    r   rq  r  C  sW    00))! *T 23K L R R$*!""%2!'
 %r   c                    g r   r   rt  s    r   rq  r  T  ru  r   rv  rp  r  r   r   r   r   r  rZ  rx  ry  r[  r\  r  rR  r  rz  r   r   )r{  r  use_astreamr|  c                    > Tb  TR                  5       (       a8  TR                  TR                  5       5      mSU4S jjn TR                  U 5        T$ )Nc                   > TU L a  S mg g r   r   )r  r  s    r   _clear2Pregel.astream.<locals>.get_waiter.<locals>._clear  s    #)Q;-1F $/r   )r  asyncio.Task[None]r   r   )r~  create_taskr  add_done_callback)r  r  rp  r  s    r   r  "Pregel.astream.<locals>.get_waiter  sB    !>V[[]]%,%8%8%GF2
 #44V<%r   c                   >#    [         R                  " [        5         [        TS5      (       a  TR                  R                  5         SSS5        Tn SmU b^  U R                  5       (       dH  U R                  5         [         R                  " [        R                  5         U I Sh  vN   SSS5        ggg! , (       d  f       Nt= f N ! , (       d  f       g= f7f)z?Wake pending waiter and/or cancel+await to avoid pending tasks.r  N)

contextlibsuppress	Exceptionhasattrr  r  r~  cancelr(  CancelledError)r  rp  r  s    r   _cleanup_waiter'Pregel.astream.<locals>._cleanup_waiter  s      (00;&vx88 & 5 5 7 < #!%=HHJ!+!4!4W5K5K!L&' "M!L 2:= <; !( "M!LsG   C,B8
AC"C(C	)C-C8
CC	C
CCr  r  r  r  r  rT  r  r  r  )r   r  r   )Zr  r  r  r   r   r;   r/   r   r   rF   r(  get_running_loopr   r   rt   r   r  r  r(   r  r   r  rG  r   r  handlersr^  r   r   r2   r-   r  r   rf   r  ro  rA   r:   r8   rq  r4   rw   r  r  rv   r  rd   ru   r   r   r   ru  r  r  r   r   rj   r7   r  r  r{  r  r5   r   r  amatch_cached_writesr  r  r  atickr  r   r   aaccept_pushr  
get_nowait
QueueEmptyr  Futurer  r  rU   rR   r  rS   r  r  r  shieldr  )+r   r  r  r`  r   rY  rZ  r[  r\  rR  r  r   r   rb  
stream_putr  r  	do_streamr]  r  r  r   r   r   r  r  r  rq  r  r  r  r  r  r  r  r  r  or  r  r  rp  r  s+                                           @@@r   astreamPregel.astream
  s=    x "(,?!@@MMMi4
 % w  %66J
 %*<

4QS@T*T %% 
 DJJ#X.J**,k]D()G00&2C2CD


 t{{F3@H,;;J8::h'	 < 
 
" )4 (11   	^	 '%'!1 /%  	!  #
(>Q   D(#vd|,DEF9Mb9Qt56\)3:vd|'7'78P'QR0077)"!>A%		&(9":t  <'  #fTl2 &t-? @ N N %6At23'(;(;WE+	G $D\--.@/RN$**73G/6F4L+,&%f&7&7F  	
  * jj mm (  .. !55 "3 !1 $ '  "&!6!6!" $(#;#;#$ "..%& "..' ( %!$<++0'2D2DT[[2Q  '11$//B )"(,"2"23K"L ;I"L<DKK%&78 GK
HL%% !\1</ 9=F& &( (&0))++*.*C*C*E$E$ED ..twwD.Q %F'-||(,

(9(9(;L(;1188Q(;L$($5$5'1*.*;*;	 (4 ( (! &- + * ) & 1 1 ' 2 2& '(& '2-///S X !!""  {{n,*-f5F.G-H IM M  )>> *#..**4;;777_
^b %F M( ( )&&0"&w~~t7O7O"PPP+ ))++2 0 '2-/// 3Q   @ 8 	..!;!;A!>???	s*  E]&Y;*]&I#\% $Y>%\% (C&\([,7Z8A[,Z
(Z
.[,
ZZ	Z6[,\[)\\% %\&B\% 5\#6\% :]&>\% [,[,	Z>[,	[
[,)\,\:[=
;\\\% \ \\ 	\% %
]#/(]]]]##]&r`  r   rY  rZ  r[  r\  rR  c                  Ub  UOU R                   nSn/ n/ nU R                  " UU4UUS:X  a  SS/OUUUUUU	S.U
D6 H  nUS:X  a  [        U5      S:X  a!  [        [        [
        [        4   U5      u  nnO/[        [        [        [        S4   [
        [        4   U5      u  nnnUS:X  a@  [        U[        5      (       a+  UR                  [        5      =nb  UR                  U5        M  US:X  a  UnM  M  UR                  U5        M     US:X  a2  U(       a)  [        U[        5      (       a  0 UE[        U0E$ [        U0$ U$ U$ )a   Run the graph with a single input and config.

Args:
    input: The input data for the graph. It can be a dictionary or any other type.
    config: The configuration for the graph run.
    context: The static context to use for the run.
        !!! version-added "Added in version 0.6.0"
    stream_mode: The stream mode for the graph run.
    print_mode: Accepts the same values as `stream_mode`, but only prints the output to the console, for debugging purposes. Does not affect the output of the graph in any way.
    output_keys: The output keys to retrieve from the graph run.
    interrupt_before: The nodes to interrupt the graph run before.
    interrupt_after: The nodes to interrupt the graph run after.
    durability: The durability mode for the graph execution, defaults to `"async"`.
        Options are:

        - `"sync"`: Changes are persisted synchronously before the next step starts.
        - `"async"`: Changes are persisted asynchronously while the next step executes.
        - `"exit"`: Changes are persisted only when the graph exits.
    **kwargs: Additional keyword arguments to pass to the graph run.

Returns:
    The output of the graph run. If `stream_mode` is `"values"`, it returns the latest output.
    If `stream_mode` is not `"values"`, it returns a list of output chunks.
Nr   r  r  r
  .)r   rp  r  r   r  r   r   r   r   r  r  r?   r   r   r   r  r  r`  r   rY  rZ  r[  r\  rR  r   latestchunksr  chunkmodepayloadr  intss                      r   r  Pregel.invoke  sv   L &1%<k$BVBV'+-/&(
[[
 h& #H-!#-+!
 
E h&u:?$(z3)?$GMD''+eCHoz3>?($AtW I%"7D11!(Y!77D%%d+X%$F & e$=
@ (" "&$// 6v5y*5 $Z0
 MMr   c                 #    Ub  UOU R                   nSn/ n/ nU R                  " UU4UUS:X  a  SS/OUUUUUU	S.U
D6  Sh  vN nUS:X  a  [        U5      S:X  a!  [        [        [
        [        4   U5      u  nnO/[        [        [        [        S4   [
        [        4   U5      u  nnnUS:X  a@  [        U[        5      (       a+  UR                  [        5      =nb  UR                  U5        M  US:X  a  UnM  M  UR                  U5        M   N
 US:X  a2  U(       a)  [        U[        5      (       a  0 UE[        U0E$ [        U0$ U$ U$ 7f)a  Asynchronously invoke the graph on a single input.

Args:
    input: The input data for the computation. It can be a dictionary or any other type.
    config: The configuration for the computation.
    context: The static context to use for the run.
        !!! version-added "Added in version 0.6.0"
    stream_mode: The stream mode for the computation.
    print_mode: Accepts the same values as `stream_mode`, but only prints the output to the console, for debugging purposes. Does not affect the output of the graph in any way.
    output_keys: The output keys to include in the result.
    interrupt_before: The nodes to interrupt before.
    interrupt_after: The nodes to interrupt after.
    durability: The durability mode for the graph execution, defaults to `"async"`.
        Options are:

        - `"sync"`: Changes are persisted synchronously before the next step starts.
        - `"async"`: Changes are persisted asynchronously while the next step executes.
        - `"exit"`: Changes are persisted only when the graph exits.
    **kwargs: Additional keyword arguments.

Returns:
    The result of the computation. If `stream_mode` is `"values"`, it returns the latest value.
    If `stream_mode` is `"chunks"`, it returns a list of chunks.
Nr   r  r  r
  .)r   r  r  r   r  r   r   r   r   r  r  r?   r   r   r  s                      r   rF  Pregel.ainvokeA  s    N &1%<k$BVBV'+-/&(
<<
 h& #H-!#-+!
 
 	%% h&u:?$(z3)?$GMD''+eCHoz3>?($AtW I%"7D11!(Y!77D%%d+X%$F & e$=	% 
@ (" "&$// 6v5y*5 $Z0
 MMs*   >E DDDCED;Ec                ^   U R                   (       d  [        S5      eU=(       d    U R                  R                  5       n/ nU HK  nX0R                  ;   d  M  UR	                  [
        [        U R                  U   5      =(       d    SU45        MM     U R                   R                  U5        g)z$Clear the cache for the given nodes.3No cache is set for this graph. Cannot clear cache.__dynamic__N)r   r   r   rc  r   r.   r\   clearr   r   
namespacesr   s       r   clear_cachePregel.clear_cache  s    zzRSS**,.
Dzz!!!'#DJJt$45F  	

$r   c                z  #    U R                   (       d  [        S5      eU=(       d    U R                  R                  5       n/ nU HK  nX0R                  ;   d  M  UR	                  [
        [        U R                  U   5      =(       d    SU45        MM     U R                   R                  U5      I Sh  vN   g N7f)z3Asynchronously clear the cache for the given nodes.r  r  N)r   r   r   rc  r   r.   r\   aclearr  s       r   aclear_cachePregel.aclear_cache  s     zzRSS**,.
Dzz!!!'#DJJt$45F  jj
+++s   AB;AB;3B94B;)r   r   r   r   r  r  r   r   r   r   r   r   r   r   r   r   r   r   r   r  ).r   z#dict[str, PregelNode | NodeBuilder]r   z0dict[str, BaseChannel | ManagedValueSpec] | Noner  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   bool | Noner   BaseCheckpointSaver | Noner   r   r   r   r   z#RetryPolicy | Sequence[RetryPolicy]r   r   r  r   r  r  r  z"Mapping[str, Sequence[str]] | Noner   r   r  Unpack[DeprecatedKwargs]r   r   r   )r  r  r  z
int | boolr   r   )r   r   r   r   )r   dict[str, Any] | Noner   r$   )r  r  r   r   r   r$   )r   r$   )rA  Sequence[str] | Noner   type[BaseModel])rA  r   r   r   )r   r  )r   r   )r  r  r   r  )r  r  r   r   )r   zSequence[str])r   r   )r{  
str | Noner|  r   r   z$Iterator[tuple[str, PregelProtocol]])r{  r  r|  r   r   z)AsyncIterator[tuple[str, PregelProtocol]])r  r   r   r   )NF)
r  r   r  zCheckpointTuple | Noner|  r  r  r   r   r   )r  r   r  r   r   r   )
r  r   r  r  r  r  r  
int | Noner   zIterator[StateSnapshot])
r  r   r  r  r  r  r  r  r   zAsyncIterator[StateSnapshot])r  r   r:  zSequence[Sequence[StateUpdate]]r   r   )NN)
r  r   r   zdict[str, Any] | Any | Noner   r  r  r  r   r   )
r  r   r   dict[str, Any] | Anyr   r  r  r  r   r   )r  r   r   !StreamMode | Sequence[StreamMode]rY  r  rZ  r   r[  All | Sequence[str] | Noner\  r  rR  Durability | Noner   ztuple[set[StreamMode], str | Sequence[str], All | Sequence[str], All | Sequence[str], BaseCheckpointSaver | None, BaseStore | None, BaseCache | None, Durability])r  InputT | Command | Noner  r  r`  ContextT | Noner   (StreamMode | Sequence[StreamMode] | NonerY  r  rZ  r   r[  r  r\  r  rR  r  r  r   r   r  r   r  r   zIterator[dict[str, Any] | Any])r  r  r  r  r`  r	  r   r
  rY  r  rZ  r   r[  r  r\  r  rR  r  r  r   r   r  r   r  r   z#AsyncIterator[dict[str, Any] | Any])r  r  r  r  r`  r	  r   r   rY  r  rZ  r   r[  r  r\  r  rR  r  r   r   r   r  )r   r   r   r   )<r   r   r   r   __doc__r   r   r   r   r   r   r   r   r   r   r  r  r   r   r  r#  r/  r6  r9  r  r&   rL  rU  rZ  propertyr^  rb  rh  rl  ro  rr  rv  ru  r  r&  r  r  r  r  r  r  r  r9  rI  rM  rP  r^  rp  r  r  rF  r  r  r   __classcell__)r4  s   @r   r   r   A  s%	   xt ! 77&K&6L$0 )(26O/6O..//''!%L,%BK>!%L,%;"E"/"E"0*,L',O'+L$+S,0N)0Z$(F!(D#11 #"*"6:5768%)!37"&"&<>+/04(,?C/E 3E C	E
 E  E E -E 4E  3E !4E ,E #E E 1E   !E"  #E$ :%E& )'E( .)E* &+E, =-E. /E0 61E2 
3EP /3
JO
+
=G
	
: /3(
JO(
+(
=G(
	(
T
'

 f @D O	O, V
 26*.*	*	* * *  /3*+*	* ) ) /3+	 " /3*+*	* 
 
 
 
 *.u%&%8<%	-%P *.u&8<	2  /3%*u
u
 &u
 ,	u

 #u
 
u
v /3%*v
v
 &v
 ,	v

 #v
 
v
r <A(
$(
48(
	(
V <A(
$(
48(
	(
\ )-(, 11 &	1
 &1 1 
!1n )-(, 55 &	5
 &5 5 
&5nQQ 4Q 
	QfLL 4L 
	Ld #"YY ,Y 	Y
 Y 
Y" #"

 %
 	

 
 

0 )-D
D
 7	D

 6D
 0D
 5D
 4D
 &D
	
D
R )-J
 $(@D8:267;6:(,!J&J &J
 !J >J 6J 0J 5J 4J &J J J +J 
(J^ )-N
 $(@D8:267;6:(,!N&N &N
 !N >N 6N 0N 5N 4N &N N N +N 
-Nf
 )-U
 $("*8:267;6:(,U&U &U
 !U  U 6U 0U 5U 4U &U U 
Ut )-V
 $("*8:267;6:(,V&V &V
 !V  V 6V 0V 5V 4V &V V 
Vp%&, ,r   r   c                    [        [        5      nU R                  5        H+  u  p#UR                   H  nX   R	                  U5        M     M-     [        U5      $ )z0Index from a trigger to nodes that depend on it.)r   r   r   r   r   r  )r   r  r   r   triggers        r   r<  r<    sL    4?4Ekkm
}}G%,,T2 % $  !!r   c           
   #    #      U" 5       u  pVnXa;   a  U(       aG  U(       a@  [        SR                  [        SU S35      [        SU S3SS9[	        U5      45      5        O2[        SR                  [        SU S35      [	        U5      45      5        X`;   aO  U(       a  [        U [        5      (       a  XVU4v   O,[        U [        5      (       a  Xg4v   OU(       a  XW4v   OUv   M  ! U a     g f = f7f)N []z[graph=yellow)color)printjoinrp   rq   r-  r   r   )r   rY  stream_subgraphsgetter	empty_excr  r  r  s           r   r  r    s      	 &Bg BHH+avQK8,wrd!_HM M HH+avQK8 M J{D$A$A))K..o%!m#C   		s(   C6
C* CC6*C30C62C33C6c                    Uc  gU c  U$ [        U [        5      =(       d    [        U 5      n[        U[        5      (       a  U(       a  U " S0 UD6$ [        [        U5      $ )aw  Coerce context input to the appropriate schema type.

If context is a dict and context_schema is a dataclass or pydantic model, we coerce.
Else, we return the context as-is.

Args:
    context_schema: The schema type to coerce to (BaseModel, dataclass, or TypedDict)
    context: The context value to coerce

Returns:
    The coerced context value or None if context is None
Nr   )rX  r"   r   r   r  r   r   )r  r`  schema_is_classs      r   r  r    s_      ; |@O '4  _((('""r   )r   r   r   r  )r   r  rY  r  r  r   r  z.Callable[[], tuple[tuple[str, ...], str, Any]]r  ztype[Exception]r   r	   )r  r   r`  r   r   r	  )
__future__r   r(  
concurrentconcurrent.futuresr  r  r  r  collectionsr   r   collections.abcr   r   r   r	   r
   r   dataclassesr   	functoolsr   inspectr   typingr   r   r   r   uuidr   r   langchain_core.globalsr   langchain_core.runnablesr   langchain_core.runnables.baser   r   langchain_core.runnables.configr   r   r   langchain_core.runnables.graphr   langgraph.cache.baser   langgraph.checkpoint.baser   r   r    langgraph.store.baser!   pydanticr"   r#   typing_extensionsr$   r%   r&   r'   langgraph._internal._configr(   r)   r*   r+   r,   r-   langgraph._internal._constantsr.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   langgraph._internal._pydanticrE   langgraph._internal._queuerF   rG   langgraph._internal._runnablerH   rI   rJ   rK   langgraph._internal._typingrL   rM   langgraph.channels.baserN   langgraph.channels.topicrO   langgraph.configrP   langgraph.constantsrQ   langgraph.errorsrR   rS   rT   rU   langgraph.managed.baserV   langgraph.pregel._algorW   rX   rY   rZ   r[   langgraph.pregel._callr\   langgraph.pregel._checkpointr]   r^   r_   r`   langgraph.pregel._drawra   langgraph.pregel._iorb   rc   langgraph.pregel._looprd   re   langgraph.pregel._messagesrf   langgraph.pregel._readrg   rh   langgraph.pregel._retryri   langgraph.pregel._runnerrj   langgraph.pregel._utilsrk   langgraph.pregel._validaterl   rm   langgraph.pregel._writern   ro   langgraph.pregel.debugrp   rq   rr   langgraph.pregel.protocolrs   rt   ru   langgraph.runtimerv   rw   langgraph.typesrx   ry   rz   r{   r|   r}   r~   r   r   r   langgraph.typingr   r   r   r   langgraph.warningsr   !langchain_core.tracers._streamingr   ImportError__all__r   r   r   r<  r  r  r   r   r   <module>rS     s   "        *  %     , 8 
 1 * 
 + + D D       2 7  B / * ' #  4  .  . 9 B < < / 1 < D C T T Q Q 6   ? > :%K $w'#-_
 _
D|-,68VW45FHfg-.|-,~["(2(1( ( ;	(
 ( (V#)#47##{b  % $%s   *I II