
    =KiK                        S r SSKJr  SSKrSSKrSSKJrJrJrJ	r	  SSK
JrJr  SSKrSSKJr  SSKJr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'   " S	 S
5      r(g)z2Synchronous client for managing runs in LangGraph.    )annotationsN)CallableIteratorMappingSequence)Anyoverload_get_run_metadata_from_response)SyncHttpClient)AllBulkCancelRunsStatusCancelAction
CheckpointCommandConfigContextDisconnectMode
DurabilityIfNotExistsInputMultitaskStrategyOnCompletionBehaviorQueryParamTypesRun	RunCreateRunCreateMetadataRunSelectField	RunStatus
StreamMode
StreamPartc                     \ rS rSrSrS+S jr\SSSSSSSSSSSSSSSSSSSSSS.                                               S,S jj5       r\SSSSSSSSSSSSSSSSSSSSS	.                                             S-S
 jj5       rSSSSSSSSSSSSSSSSSSSSSSSSS.                                                     S.S jjr\SSSSSSSSSSSSSSSSSSS.                                         S/S jj5       r\SSSSSSSSSSSSSSSSSSSSS.                                             S0S jj5       rSSSSSSSSSSSSSSSSSSSSSSS.                                                 S1S jjrSSS.       S2S jjr	\SSSSSSSSSSSSSSSSSSSS.                                           S3S jj5       r
\SSSSSSSSSSSSSSSSSS.                                       S4S jj5       r
SSSSSSSSSSSSSSSSSSSSSS.                                               S5S jjr
SSSSSSS.               S6S jjrSSS.         S7S  jjrSS!SSS".             S8S# jjrSSSS!SSS$.             S9S% jjrSSS.         S:S& jjrSSSSSS'.               S;S( jjrSSS.         S<S) jjrS*rg)=SyncRunsClient'   a^  Synchronous client for managing runs in LangGraph.

This class provides methods to create, retrieve, and manage runs, which represent
individual executions of graphs.

???+ example "Example"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    run = client.runs.create(thread_id="thread_123", assistant_id="asst_456")
    ```
c                    Xl         g Nhttp)selfr(   s     Z/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langgraph_sdk/_sync/runs.py__init__SyncRunsClient.__init__5   s    	    NvaluesF)inputcommandstream_modestream_subgraphsmetadataconfigcontext
checkpointcheckpoint_idcheckpoint_duringinterrupt_beforeinterrupt_afterfeedback_keyson_disconnectwebhookmultitask_strategyif_not_existsafter_secondsheadersparamson_run_createdc                   g r&    )r)   	thread_idassistant_idr/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   s                           r*   streamSyncRunsClient.stream8   s    6  #r-   )r/   r0   r1   r2   stream_resumabler3   r4   r5   r8   r9   r:   r;   r<   on_completionr?   r=   r@   rA   rB   rC   c                   g r&   rE   )r)   rF   rG   r/   r0   r1   r2   rJ   r3   r4   r5   r8   r9   r:   r;   r<   rK   r?   r=   r@   rA   rB   rC   s                          r*   rH   rI   U   s    4  #r-   )r/   r0   r1   r2   rJ   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   rK   r=   r>   r?   r@   rA   rB   rC   
durabilityc          
       ^ Ub  [         R                  " S[        SS9  0 SU_SU(       a,  UR                  5        VVs0 s H  u  nnUc  M  UU_M     snnOS_SU	_SU
_S	U_S
U_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_UUUUUS.EnUb  SU S3OSnSU4S jjnU R                  R                  USUR                  5        VVs0 s H  u  nnUc  M  UU_M     snnUUT(       a  US9$ SS9$ s  snnf s  snnf )a  Create a run and stream the results.

Args:
    thread_id: the thread ID to assign to the thread.
        If `None` will create a stateless run.
    assistant_id: The assistant ID or graph name to stream from.
        If using graph name, will default to first assistant created from that graph.
    input: The input to the graph.
    command: The command to execute.
    stream_mode: The stream mode(s) to use.
    stream_subgraphs: Whether to stream output from subgraphs.
    stream_resumable: Whether the stream is considered resumable.
        If true, the stream can be resumed and replayed in its entirety even after disconnection.
    metadata: Metadata to assign to the run.
    config: The configuration for the assistant.
    context: Static context to add to the assistant.
        !!! version-added "Added in version 0.6.0"
    checkpoint: The checkpoint to resume from.
    checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
    interrupt_before: Nodes to interrupt immediately before they get executed.
    interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
    feedback_keys: Feedback keys to assign to run.
    on_disconnect: The disconnect mode to use.
        Must be one of 'cancel' or 'continue'.
    on_completion: Whether to delete or keep the thread created for a stateless run.
        Must be one of 'delete' or 'keep'.
    webhook: Webhook to call after LangGraph API call is done.
    multitask_strategy: Multitask strategy to use.
        Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
    if_not_exists: How to handle missing thread. Defaults to 'reject'.
        Must be either 'reject' (raise error if missing), or 'create' (create new thread).
    after_seconds: The number of seconds to wait before starting the run.
        Use to schedule future runs.
    headers: Optional custom headers to include with the request.
    on_run_created: Optional callback to call when a run is created.
    durability: The durability to use for the run. Values are "sync", "async", or "exit".
        "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
        "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
        "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps


Returns:
    Iterator of stream results.

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    async for chunk in client.runs.stream(
        thread_id=None,
        assistant_id="agent",
        input={"messages": [{"role": "user", "content": "how are you?"}]},
        stream_mode=["values","debug"],
        metadata={"name":"my_run"},
        context={"model_name": "anthropic"},
        interrupt_before=["node_to_stop_before_1","node_to_stop_before_2"],
        interrupt_after=["node_to_stop_after_1","node_to_stop_after_2"],
        feedback_keys=["my_feedback_key_1","my_feedback_key_2"],
        webhook="https://my.fake.webhook.com",
        multitask_strategy="interrupt"
    ):
        print(chunk)
    ```
    ```shell
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    StreamPart(event='metadata', data={'run_id': '1ef4a9b8-d7da-679a-a45a-872054341df2'})
    StreamPart(event='values', data={'messages': [{'content': 'how are you?', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'fe0a5778-cfe9-42ee-b807-0adaa1873c10', 'example': False}]})
    StreamPart(event='values', data={'messages': [{'content': 'how are you?', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'fe0a5778-cfe9-42ee-b807-0adaa1873c10', 'example': False}, {'content': "I'm doing well, thanks for asking! I'm an AI assistant created by Anthropic to be helpful, honest, and harmless.", 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-159b782c-b679-4830-83c6-cef87798fe8b', 'example': False, 'tool_calls': [], 'invalid_tool_calls': [], 'usage_metadata': None}]})
    StreamPart(event='end', data=None)
    ```
Nd`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.   
stacklevelr/   r0   r4   r5   r3   r1   r2   rJ   rG   r9   r:   r;   r=   r6   r7   r8   r>   )r?   r<   rK   r@   rM   	/threads/z/runs/streamc                L   > T(       a  [        U 5      =n(       a	  T" U5        gggz)Callback function to handle the response.Nr
   resr3   rC   s     r*   on_response*SyncRunsClient.stream.<locals>.on_response   &    /Ns/S#S8#Sx( $T~r-   POSTjsonrB   rA   rX   rW   zhttpx.Response)warningswarnDeprecationWarningitemsr(   rH   ) r)   rF   rG   r/   r0   r1   r2   rJ   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   rK   r=   r>   r?   r@   rA   rB   rC   rM   kvpayloadendpointrX   s                             `      r*   rH   rI   q   s   L (MMv"

U
GN'--/C/$!QQA/CTX

 f
 w
 
 ;
  0
  0
 L
  0
 
 ]
 w
  *!
" ]#
$  !2%
& !"4'
( +***$1
8 $ 	{,/ 		)
 yy#*==?D?41aa$!Q$?D'5   
 	
 <@   
 	
E DJ Es   
C5
C5

C;C;)r/   r0   r1   r2   rJ   r3   r4   r5   r8   r9   r:   r=   rK   r?   r@   rA   rB   rC   c                   g r&   rE   )r)   rF   rG   r/   r0   r1   r2   rJ   r3   r4   r5   r8   r9   r:   r=   rK   r?   r@   rA   rB   rC   s                        r*   createSyncRunsClient.create  s    0 r-   )r/   r0   r1   r2   rJ   r3   r4   r5   r6   r7   r8   r9   r:   r=   r>   r?   r@   rA   rB   rC   c                   g r&   rE   )r)   rF   rG   r/   r0   r1   r2   rJ   r3   r4   r5   r6   r7   r8   r9   r:   r=   r>   r?   r@   rA   rB   rC   s                          r*   rh   ri   %  s    4 r-   )r/   r0   r1   r2   rJ   r3   r4   r5   r6   r7   r8   r9   r:   r=   r>   r?   rK   r@   rA   rB   rC   rM   c                 ^ Ub  [         R                  " S[        SS9  0 SU_SU(       a,  UR                  5        VVs0 s H  u  nnUc  M  UU_M     snnOS_SU_SU_S	U_S
U	_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_UUUS.EnUR                  5        VVs0 s H  u  nnUc  M  UU_M     nnnSU4S jjnU R                  R                  U(       a  SU S3OSUUUT(       a  US9$ SS9$ s  snnf s  snnf )a  Create a background run.

Args:
    thread_id: the thread ID to assign to the thread.
        If `None` will create a stateless run.
    assistant_id: The assistant ID or graph name to stream from.
        If using graph name, will default to first assistant created from that graph.
    input: The input to the graph.
    command: The command to execute.
    stream_mode: The stream mode(s) to use.
    stream_subgraphs: Whether to stream output from subgraphs.
    stream_resumable: Whether the stream is considered resumable.
        If true, the stream can be resumed and replayed in its entirety even after disconnection.
    metadata: Metadata to assign to the run.
    config: The configuration for the assistant.
    context: Static context to add to the assistant.
        !!! version-added "Added in version 0.6.0"
    checkpoint: The checkpoint to resume from.
    checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
    interrupt_before: Nodes to interrupt immediately before they get executed.
    interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
    webhook: Webhook to call after LangGraph API call is done.
    multitask_strategy: Multitask strategy to use.
        Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
    on_completion: Whether to delete or keep the thread created for a stateless run.
        Must be one of 'delete' or 'keep'.
    if_not_exists: How to handle missing thread. Defaults to 'reject'.
        Must be either 'reject' (raise error if missing), or 'create' (create new thread).
    after_seconds: The number of seconds to wait before starting the run.
        Use to schedule future runs.
    headers: Optional custom headers to include with the request.
    on_run_created: Optional callback to call when a run is created.
    durability: The durability to use for the run. Values are "sync", "async", or "exit".
        "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
        "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
        "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps

Returns:
    The created background `Run`.

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    background_run = client.runs.create(
        thread_id="my_thread_id",
        assistant_id="my_assistant_id",
        input={"messages": [{"role": "user", "content": "hello!"}]},
        metadata={"name":"my_run"},
        context={"model_name": "openai"},
        interrupt_before=["node_to_stop_before_1","node_to_stop_before_2"],
        interrupt_after=["node_to_stop_after_1","node_to_stop_after_2"],
        webhook="https://my.fake.webhook.com",
        multitask_strategy="interrupt"
    )
    print(background_run)
    ```

    ```shell
    --------------------------------------------------------------------------------

    {
        'run_id': 'my_run_id',
        'thread_id': 'my_thread_id',
        'assistant_id': 'my_assistant_id',
        'created_at': '2024-07-25T15:35:42.598503+00:00',
        'updated_at': '2024-07-25T15:35:42.598503+00:00',
        'metadata': {},
        'status': 'pending',
        'kwargs':
            {
                'input':
                    {
                        'messages': [
                            {
                                'role': 'user',
                                'content': 'how are you?'
                            }
                        ]
                    },
                'config':
                    {
                        'metadata':
                            {
                                'created_by': 'system'
                            },
                        'configurable':
                            {
                                'run_id': 'my_run_id',
                                'user_id': None,
                                'graph_id': 'agent',
                                'thread_id': 'my_thread_id',
                                'checkpoint_id': None,
                                'assistant_id': 'my_assistant_id'
                            }
                    },
                'context':
                    {
                        'model_name': 'openai'
                    },
                'webhook': "https://my.fake.webhook.com",
                'temporary': False,
                'stream_mode': ['values'],
                'feedback_keys': None,
                'interrupt_after': ["node_to_stop_after_1","node_to_stop_after_2"],
                'interrupt_before': ["node_to_stop_before_1","node_to_stop_before_2"]
            },
        'multitask_strategy': 'interrupt'
    }
    ```
NrO   rP   rQ   r/   r0   r1   r2   rJ   r4   r5   r3   rG   r9   r:   r=   r6   r7   r8   r>   r?   )rK   r@   rM   c                L   > T(       a  [        U 5      =n(       a	  T" U5        gggrU   r
   rV   s     r*   rX   *SyncRunsClient.create.<locals>.on_response  rZ   r-   rS   /runsr\   r^   )r_   r`   ra   rb   r(   post)r)   rF   rG   r/   r0   r1   r2   rJ   r3   r4   r5   r6   r7   r8   r9   r:   r=   r>   r?   rK   r@   rA   rB   rC   rM   rc   rd   re   rX   s                          `     r*   rh   ri   A  s   V (MMv"

U
GN'--/C/$!QQA/CTX

 ;
  0
  0
 f
 w
 
 L
  0
 
 w
 *
  ]!
"  !2#
$ !"4%
& ]'
( +*$-
0 %,MMOEODAqq41a4OE	)
 yy~~,5i	{%(7'5  
 	

 <@  
 	
9 D* Fs   
C5
C5
 
C;.C;rA   rB   c               z    SS jnU Vs/ s H
  oT" U5      PM     nnU R                   R                  SXbUS9$ s  snf )z,Create a batch of stateless background runs.c                b    U R                  5        VVs0 s H  u  pUc  M
  X_M     snn$ s  snnf r&   )rb   )re   rc   rd   s      r*   filter_payload3SyncRunsClient.create_batch.<locals>.filter_payload  s(    %,]]_F_TQDAD_FFFs   	++z/runs/batchr]   rA   rB   )re   r   )r(   ro   )r)   payloadsrA   rB   rs   re   filtereds          r*   create_batchSyncRunsClient.create_batch  sK    	G <DD8N7+8Dyy~~&  
 	
 Es   8T)r/   r0   r3   r4   r5   r6   r7   r8   r9   r:   r=   r<   r>   r?   r@   raise_errorrA   rB   rC   c                   g r&   rE   )r)   rF   rG   r/   r0   r3   r4   r5   r6   r7   r8   r9   r:   r=   r<   r>   r?   r@   rz   rA   rB   rC   s                         r*   waitSyncRunsClient.wait
  s    2 03r-   )r/   r0   r3   r4   r5   r8   r9   r:   r=   r<   rK   r?   r@   rz   rA   rB   rC   c                   g r&   rE   )r)   rF   rG   r/   r0   r3   r4   r5   r8   r9   r:   r=   r<   rK   r?   r@   rz   rA   rB   rC   s                       r*   r|   r}   %  s    . 03r-   )r/   r0   r3   r4   r5   r8   r6   r7   r9   r:   r=   r<   rK   r>   r?   r@   rz   rA   rB   rC   rM   c          
       ^ Ub  [         R                  " S[        SS9  0 SU_SU(       a,  UR                  5        VVs0 s H  u  nnUc  M  UU_M     snnOS_SU_SU_S	U_S
U_SU_SU_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_UUS.EnSU4S jjnUb  SU S3OSnU R                  R                  USUR                  5        VVs0 s H  u  nnUc  M  UU_M     snnUUT(       a  US9$ SS9$ s  snnf s  snnf )a#  Create a run, wait until it finishes and return the final state.

Args:
    thread_id: the thread ID to create the run on.
        If `None` will create a stateless run.
    assistant_id: The assistant ID or graph name to run.
        If using graph name, will default to first assistant created from that graph.
    input: The input to the graph.
    command: The command to execute.
    metadata: Metadata to assign to the run.
    config: The configuration for the assistant.
    context: Static context to add to the assistant.
        !!! version-added "Added in version 0.6.0"
    checkpoint: The checkpoint to resume from.
    checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
    interrupt_before: Nodes to interrupt immediately before they get executed.
    interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
    webhook: Webhook to call after LangGraph API call is done.
    on_disconnect: The disconnect mode to use.
        Must be one of 'cancel' or 'continue'.
    on_completion: Whether to delete or keep the thread created for a stateless run.
        Must be one of 'delete' or 'keep'.
    multitask_strategy: Multitask strategy to use.
        Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
    if_not_exists: How to handle missing thread. Defaults to 'reject'.
        Must be either 'reject' (raise error if missing), or 'create' (create new thread).
    after_seconds: The number of seconds to wait before starting the run.
        Use to schedule future runs.
    raise_error: Whether to raise an error if the run fails.
    headers: Optional custom headers to include with the request.
    on_run_created: Optional callback to call when a run is created.
    durability: The durability to use for the run. Values are "sync", "async", or "exit".
        "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
        "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
        "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps

Returns:
    The output of the `Run`.

???+ example "Example Usage"

    ```python

    final_state_of_run = client.runs.wait(
        thread_id=None,
        assistant_id="agent",
        input={"messages": [{"role": "user", "content": "how are you?"}]},
        metadata={"name":"my_run"},
        context={"model_name": "anthropic"},
        interrupt_before=["node_to_stop_before_1","node_to_stop_before_2"],
        interrupt_after=["node_to_stop_after_1","node_to_stop_after_2"],
        webhook="https://my.fake.webhook.com",
        multitask_strategy="interrupt"
    )
    print(final_state_of_run)
    ```

    ```shell

    -------------------------------------------------------------------------------------------------------------------------------------------

    {
        'messages': [
            {
                'content': 'how are you?',
                'additional_kwargs': {},
                'response_metadata': {},
                'type': 'human',
                'name': None,
                'id': 'f51a862c-62fe-4866-863b-b0863e8ad78a',
                'example': False
            },
            {
                'content': "I'm doing well, thanks for asking! I'm an AI assistant created by Anthropic to be helpful, honest, and harmless.",
                'additional_kwargs': {},
                'response_metadata': {},
                'type': 'ai',
                'name': None,
                'id': 'run-bf1cd3c6-768f-4c16-b62d-ba6f17ad8b36',
                'example': False,
                'tool_calls': [],
                'invalid_tool_calls': [],
                'usage_metadata': None
            }
        ]
    }
    ```

NrO   rP   rQ   r/   r0   r4   r5   r3   rG   r9   r:   r=   r6   r7   r>   r?   r<   r8   rK   r@   )rz   rM   c                L   > T(       a  [        U 5      =n(       a	  T" U5        gggrU   r
   rV   s     r*   rX   (SyncRunsClient.wait.<locals>.on_response  rZ   r-   rS   z
/runs/waitr[   r\   r^   )r_   r`   ra   rb   r(   request_reconnect)r)   rF   rG   r/   r0   r3   r4   r5   r8   r6   r7   r9   r:   r=   r<   rK   r>   r?   r@   rz   rA   rB   rC   rM   rc   rd   re   rX   rf   s                         `      r*   r|   r}   >  s   h (MMv"

U
GN'--/C/$!QQA/CTX

 f
 w
 
 L
  0
 
 w
 *
 ]
 !"4
 ]
  ]!
"  !2#
$ ]%
& ]'
( '$+
0	) 2;1Fi	{*-L 	 yy**#*==?D?41aa$!Q$?D'5 + 
 	
 <@ + 
 	
; D@ Es   
C2
C2
	
C8C8
   r   )limitoffsetstatusselectrA   rB   c                   X#S.nUb  XHS'   U(       a  XXS'   U(       a  UR                  U5        U R                  R                  SU S3XS9$ )a  List runs.

Args:
    thread_id: The thread ID to list runs for.
    limit: The maximum number of results to return.
    offset: The number of results to skip.
    headers: Optional custom headers to include with the request.
    params: Optional query parameters to include with the request.

Returns:
    The runs for the thread.

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    client.runs.list(
        thread_id="thread_id",
        limit=5,
        offset=5,
    )
    ```

)r   r   r   r   rS   rn   rB   rA   )updater(   get)	r)   rF   r   r   r   r   rA   rB   query_paramss	            r*   listSyncRunsClient.list  s_    F 27'I%+"%+"'yy}}	{%(  
 	
r-   c               B    U R                   R                  SU SU 3X4S9$ )aW  Get a run.

Args:
    thread_id: The thread ID to get.
    run_id: The run ID to get.
    headers: Optional custom headers to include with the request.

Returns:
    `Run` object.

???+ example "Example Usage"

    ```python

    run = client.runs.get(
        thread_id="thread_id_to_delete",
        run_id="run_id_to_delete",
    )
    ```
rS   /runs/rp   )r(   r   r)   rF   run_idrA   rB   s        r*   r   SyncRunsClient.get  s0    : yy}}	{&17  
 	
r-   	interrupt)r|   actionrA   rB   c                   U(       a  SOSUS.nU(       a  UR                  U5        U(       a$  U R                  R                  SU SU S3SSUUS	9$ U R                  R                  SU SU S3SUUS	9$ )
a  Get a run.

Args:
    thread_id: The thread ID to cancel.
    run_id: The run ID to cancel.
    wait: Whether to wait until run has completed.
    action: Action to take when cancelling the run. Possible values
        are `interrupt` or `rollback`. Default is `interrupt`.
    headers: Optional custom headers to include with the request.
    params: Optional query parameters to include with the request.

Returns:
    `None`

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    client.runs.cancel(
        thread_id="thread_id_to_cancel",
        run_id="run_id_to_cancel",
        wait=True,
        action="interrupt"
    )
    ```

   r   )r|   r   rS   r   z/cancelr[   N)r]   rB   rA   )r   r(   r   ro   )r)   rF   r   r|   r   rA   rB   r   s           r*   cancelSyncRunsClient.cancel0  s    L A1
 '99..I;fVHG<# /   yy~~	{&8	  
 	
r-   )rF   run_idsr   r   rA   rB   c                   0 nU(       a  XS'   U(       a  X'S'   U(       a  X7S'   SU0nU(       a  UR                  U5        U R                  R                  SUUUS9  g)a  Cancel one or more runs.

Can cancel runs by thread ID and run IDs, or by status filter.

Args:
    thread_id: The ID of the thread containing runs to cancel.
    run_ids: List of run IDs to cancel.
    status: Filter runs by status to cancel. Must be one of
        `"pending"`, `"running"`, or `"all"`.
    action: Action to take when cancelling the run. Possible values
        are `"interrupt"` or `"rollback"`. Default is `"interrupt"`.
    headers: Optional custom headers to include with the request.
    params: Optional query parameters to include with the request.

Returns:
    `None`

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    # Cancel all pending runs
    client.runs.cancel_many(status="pending")
    # Cancel specific runs on a thread
    client.runs.cancel_many(
        thread_id="my_thread_id",
        run_ids=["run_1", "run_2"],
        action="rollback",
    )
    ```

rF   r   r   r   z/runs/cancelru   N)r   r(   ro   )	r)   rF   r   r   r   rA   rB   re   r   s	            r*   cancel_manySyncRunsClient.cancel_manyj  sg    T #%#,K !(I &H(0&'9'			 	 	
r-   c               H    U R                   R                  SU SU S3SUUS9$ )a  Block until a run is done. Returns the final state of the thread.

Args:
    thread_id: The thread ID to join.
    run_id: The run ID to join.
    headers: Optional custom headers to include with the request.
    params: Optional query parameters to include with the request.

Returns:
    `None`

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    client.runs.join(
        thread_id="thread_id_to_join",
        run_id="run_id_to_join"
    )
    ```

rS   r   z/joinGETrp   )r(   r   r   s        r*   joinSyncRunsClient.join  s;    < yy**	{&6	 + 
 	
r-   )cancel_on_disconnectr1   rA   rB   last_event_idc                   UUS.nU(       a  UR                  U5        U R                  R                  SU SU S3SU0 U(       a  SU0O0 EU=(       d    0 E=(       d    SS9$ )	a  Stream output from a run in real-time, until the run is done.
Output is not buffered, so any output produced before this call will
not be received here.

Args:
    thread_id: The thread ID to join.
    run_id: The run ID to join.
    stream_mode: The stream mode(s) to use. Must be a subset of the stream modes passed
        when creating the run. Background runs default to having the union of all
        stream modes.
    cancel_on_disconnect: Whether to cancel the run when the stream is disconnected.
    headers: Optional custom headers to include with the request.
    params: Optional query parameters to include with the request.
    last_event_id: The last event ID to use for the stream.

Returns:
    `None`

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    client.runs.join_stream(
        thread_id="thread_id_to_join",
        run_id="run_id_to_join",
        stream_mode=["values", "debug"]
    )
    ```

)r1   r   rS   r   z/streamr   zLast-Event-IDNr   )r   r(   rH   )	r)   rF   r   r   r1   rA   rB   r   r   s	            r*   join_streamSyncRunsClient.join_stream  s    T '$8
 'yy	{&87DO]3"=b     	
 		
r-   c               D    U R                   R                  SU SU 3X4S9  g)a  Delete a run.

Args:
    thread_id: The thread ID to delete.
    run_id: The run ID to delete.
    headers: Optional custom headers to include with the request.
    params: Optional query parameters to include with the request.

Returns:
    `None`

???+ example "Example Usage"

    ```python
    client = get_sync_client(url="http://localhost:2024")
    client.runs.delete(
        thread_id="thread_id_to_delete",
        run_id="run_id_to_delete"
    )
    ```

rS   r   rp   N)r(   deleter   s        r*   r   SyncRunsClient.delete  s-    < 				{&17 	 	
r-   r'   )r(   r   returnNone)0rF   strrG   r   r/   Input | Noner0   Command | Noner1   !StreamMode | Sequence[StreamMode]r2   boolr3   Mapping[str, Any] | Noner4   Config | Noner5   Context | Noner6   Checkpoint | Noner7   
str | Noner8   bool | Noner9   All | Sequence[str] | Noner:   r   r;   Sequence[str] | Noner<   DisconnectMode | Noner=   r   r>   MultitaskStrategy | Noner?   IfNotExists | Noner@   
int | NonerA   Mapping[str, str] | NonerB   QueryParamTypes | NonerC   *Callable[[RunCreateMetadata], None] | Noner   Iterator[StreamPart]).rF   r   rG   r   r/   r   r0   r   r1   r   r2   r   rJ   r   r3   r   r4   r   r5   r   r8   r   r9   r   r:   r   r;   r   r<   r   rK   OnCompletionBehavior | Noner?   r   r=   r   r@   r   rA   r   rB   r   rC   r   r   r   )6rF   r   rG   r   r/   r   r0   r   r1   r   r2   r   rJ   r   r3   r   r4   r   r5   r   r6   r   r7   r   r8   r   r9   r   r:   r   r;   r   r<   r   rK   r   r=   r   r>   r   r?   r   r@   r   rA   r   rB   r   rC   r   rM   Durability | Noner   r   )*rF   r   rG   r   r/   r   r0   r   r1   r   r2   r   rJ   r   r3   r   r4   r   r5   r   r8   r   r9   r   r:   r   r=   r   rK   r   r?   r   r@   r   rA   r   rB   r   rC   r   r   r   ).rF   r   rG   r   r/   r   r0   r   r1   r   r2   r   rJ   r   r3   r   r4   r   r5   r   r6   r   r7   r   r8   r   r9   r   r:   r   r=   r   r>   r   r?   r   r@   r   rA   r   rB   r   rC   r   r   r   )2rF   r   rG   r   r/   r   r0   r   r1   r   r2   r   rJ   r   r3   r   r4   r   r5   r   r6   r   r7   r   r8   r   r9   r   r:   r   r=   r   r>   r   r?   r   rK   r   r@   r   rA   r   rB   r   rC   r   rM   r   r   r   )rv   zbuiltins.list[RunCreate]rA   r   rB   r   r   builtins.list[Run]),rF   r   rG   r   r/   r   r0   r   r3   r   r4   r   r5   r   r6   r   r7   r   r8   r   r9   r   r:   r   r=   r   r<   r   r>   r   r?   r   r@   r   rz   r   rA   r   rB   r   rC   r   r   $builtins.list[dict] | dict[str, Any])(rF   r   rG   r   r/   r   r0   r   r3   r   r4   r   r5   r   r8   r   r9   r   r:   r   r=   r   r<   r   rK   r   r?   r   r@   r   rz   r   rA   r   rB   r   rC   r   r   r   )0rF   r   rG   r   r/   r   r0   r   r3   r   r4   r   r5   r   r8   r   r6   r   r7   r   r9   r   r:   r   r=   r   r<   r   rK   r   r>   r   r?   r   r@   r   rz   r   rA   r   rB   r   rC   r   rM   r   r   r   )rF   r   r   intr   r   r   zRunStatus | Noner   z$builtins.list[RunSelectField] | NonerA   r   rB   r   r   r   )
rF   r   r   r   rA   r   rB   r   r   r   )rF   r   r   r   r|   r   r   r   rA   r   rB   r   r   r   )rF   r   r   r   r   zBulkCancelRunsStatus | Noner   r   rA   r   rB   r   r   r   )
rF   r   r   r   rA   r   rB   r   r   dict)rF   r   r   r   r   r   r1   z(StreamMode | Sequence[StreamMode] | NonerA   r   rB   r   r   r   r   r   )
rF   r   r   r   rA   r   rB   r   r   r   )__name__
__module____qualname____firstlineno____doc__r+   r	   rH   rh   rx   r|   r   r   r   r   r   r   r   __static_attributes__rE   r-   r*   r#   r#   '   s     #"&9A!&-1 $"&(,$()-7;6:.2/3"7;,0$(,0)-EI3## #
 #  # 7# # +# #  # &# "# '# 5#  4!#" ,##$ -%#& '#( 5)#* *+#, "-#. */#0 '1#2 C3#4 
5# #8  #"&9A!&!&-1 $"&)-7;6:.2/359,0"$(,0)-EI1## #
 #  # 7# # # +# #  # '# 5# 4#  ,!#" -##$ 3%#& *'#( )#* "+#, *-#. '/#0 C1#2 
3# #@ #"&9A!&!&-1 $"&(,$()-7;6:.2/359"7;,0$(,0)-EI(,9X
X
 X

 X
  X
 7X
 X
 X
 +X
 X
  X
 &X
 "X
 'X
  5!X
" 4#X
$ ,%X
& -'X
( 3)X
* +X
, 5-X
. */X
0 "1X
2 *3X
4 '5X
6 C7X
8 &9X
: 
;X
t  #"&9A!&!&-1 $"&)-7;6:"59,0$(,0)-EI- 
    7   +    ' 5 4  !" 3#$ *%& "'( *)* '+, C-. 
/ 2  #"&9A!&!&-1 $"&(,$()-7;6:"7;,0$(,0)-EI1 
    7   +    & " '  5!" 4#$ %& 5'( *)* "+, *-. '/0 C12 
3 @ #"&9A!&!&-1 $"&(,$()-7;6:"7;,059$(,0)-EI(,5v
v
 v

 v
  v
 7v
 v
 v
 +v
 v
  v
 &v
 "v
 'v
  5!v
" 4#v
$ %v
& 5'v
( *)v
* 3+v
, "-v
. */v
0 '1v
2 C3v
4 &5v
6 
7v
x -1)-
*
 *	

 '
 

"  #"&-1 $"&(,$()-7;6:"/37;,0$( ,0)-EI/33 3
 3  3 +3 3  3 &3 "3 '3 53 43 3  -!3" 5#3$ *%3& "'3( )3* *+3, '-3. C/30 
.13 34  #"&-1 $"&)-7;6:"/359,0$( ,0)-EI+33 3
 3  3 +3 3  3 '3 53 43 3 -3 33  *!3" "#3$ %3& *'3( ')3* C+3, 
.-3 3: #"&-1 $"&)-(,$(7;6:"/3597;,0$( ,0)-EI(,3a
a
 a

 a
  a
 +a
 a
  a
 'a
 &a
 "a
 5a
 4a
 a
  -!a
" 3#a
$ 5%a
& *'a
( ")a
* +a
, *-a
. '/a
0 C1a
2 &3a
4 
.5a
N #'7;,0)-,
,
 	,

 ,
 !,
 5,
 *,
 ',
 
,
f -1)-

 

 *
 '
 

L *,0)-8
8
 8

 8
 8
 *8
 '8
 
8
z !%(,.2*,0)-9
 9
 &	9

 ,9
 9
 *9
 '9
 
9
@ -1)-#
#
 #

 *#
 '#
 
#
T &+@D,0)-$(8
8
 8

 #8
 >8
 *8
 '8
 "8
 
8
~ -1)- 
 
  

 * 
 ' 
 
 
  
r-   r#   ))r   
__future__r   builtinsr_   collections.abcr   r   r   r   typingr   r	   httpxlanggraph_sdk._shared.utilitiesr   langgraph_sdk._sync.httpr   langgraph_sdk.schemar   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r#   rE   r-   r*   <module>r      sM    8 "   A A    K 3     2}
 }
r-   