langgraph-sdk 0.2.3__tar.gz → 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-sdk
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: SDK for interacting with LangGraph API
5
5
  Project-URL: Repository, https://www.github.com/langchain-ai/langgraph
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  from langgraph_sdk.auth import Auth
2
2
  from langgraph_sdk.client import get_client, get_sync_client
3
3
 
4
- __version__ = "0.2.3"
4
+ __version__ = "0.2.4"
5
5
 
6
6
  __all__ = ["Auth", "get_client", "get_sync_client"]
@@ -15,6 +15,7 @@ import logging
15
15
  import os
16
16
  import re
17
17
  import sys
18
+ import warnings
18
19
  from collections.abc import AsyncIterator, Iterator, Mapping, Sequence
19
20
  from types import TracebackType
20
21
  from typing import (
@@ -45,6 +46,7 @@ from langgraph_sdk.schema import (
45
46
  CronSelectField,
46
47
  CronSortBy,
47
48
  DisconnectMode,
49
+ Durability,
48
50
  GraphSchema,
49
51
  IfNotExists,
50
52
  Item,
@@ -69,6 +71,7 @@ from langgraph_sdk.schema import (
69
71
  ThreadSortBy,
70
72
  ThreadState,
71
73
  ThreadStatus,
74
+ ThreadStreamMode,
72
75
  ThreadUpdateStateResponse,
73
76
  )
74
77
  from langgraph_sdk.sse import SSEDecoder, aiter_lines_raw, iter_lines_raw
@@ -1682,6 +1685,53 @@ class ThreadsClient:
1682
1685
  params=params,
1683
1686
  )
1684
1687
 
1688
+ async def join_stream(
1689
+ self,
1690
+ thread_id: str,
1691
+ *,
1692
+ last_event_id: str | None = None,
1693
+ stream_mode: ThreadStreamMode | Sequence[ThreadStreamMode] = "run_modes",
1694
+ headers: Mapping[str, str] | None = None,
1695
+ params: QueryParamTypes | None = None,
1696
+ ) -> AsyncIterator[StreamPart]:
1697
+ """Get a stream of events for a thread.
1698
+
1699
+ Args:
1700
+ thread_id: The ID of the thread to get the stream for.
1701
+ last_event_id: The ID of the last event to get.
1702
+ headers: Optional custom headers to include with the request.
1703
+ params: Optional query parameters to include with the request.
1704
+
1705
+ Returns:
1706
+ Iterator[StreamPart]: An iterator of stream parts.
1707
+
1708
+ ???+ example "Example Usage"
1709
+
1710
+ ```python
1711
+
1712
+ for chunk in client.threads.join_stream(
1713
+ thread_id="my_thread_id",
1714
+ last_event_id="my_event_id",
1715
+ ):
1716
+ print(chunk)
1717
+ ```
1718
+
1719
+ """ # noqa: E501
1720
+ query_params = {
1721
+ "stream_mode": stream_mode,
1722
+ }
1723
+ if params:
1724
+ query_params.update(params)
1725
+ return self.http.stream(
1726
+ f"/threads/{thread_id}/stream",
1727
+ "GET",
1728
+ headers={
1729
+ **({"Last-Event-ID": last_event_id} if last_event_id else {}),
1730
+ **(headers or {}),
1731
+ },
1732
+ params=query_params,
1733
+ )
1734
+
1685
1735
 
1686
1736
  class RunsClient:
1687
1737
  """Client for managing runs in LangGraph.
@@ -1772,7 +1822,7 @@ class RunsClient:
1772
1822
  context: Context | None = None,
1773
1823
  checkpoint: Checkpoint | None = None,
1774
1824
  checkpoint_id: str | None = None,
1775
- checkpoint_during: bool | None = None,
1825
+ checkpoint_during: bool | None = None, # deprecated
1776
1826
  interrupt_before: All | Sequence[str] | None = None,
1777
1827
  interrupt_after: All | Sequence[str] | None = None,
1778
1828
  feedback_keys: Sequence[str] | None = None,
@@ -1785,6 +1835,7 @@ class RunsClient:
1785
1835
  headers: Mapping[str, str] | None = None,
1786
1836
  params: QueryParamTypes | None = None,
1787
1837
  on_run_created: Callable[[RunCreateMetadata], None] | None = None,
1838
+ durability: Durability | None = None,
1788
1839
  ) -> AsyncIterator[StreamPart]:
1789
1840
  """Create a run and stream the results.
1790
1841
 
@@ -1804,7 +1855,7 @@ class RunsClient:
1804
1855
  context: Static context to add to the assistant.
1805
1856
  !!! version-added "Supported with langgraph>=0.6.0"
1806
1857
  checkpoint: The checkpoint to resume from.
1807
- checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
1858
+ checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
1808
1859
  interrupt_before: Nodes to interrupt immediately before they get executed.
1809
1860
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
1810
1861
  feedback_keys: Feedback keys to assign to run.
@@ -1822,6 +1873,10 @@ class RunsClient:
1822
1873
  headers: Optional custom headers to include with the request.
1823
1874
  params: Optional query parameters to include with the request.
1824
1875
  on_run_created: Callback when a run is created.
1876
+ durability: The durability to use for the run. Values are "sync", "async", or "exit".
1877
+ "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
1878
+ "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
1879
+ "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
1825
1880
 
1826
1881
  Returns:
1827
1882
  AsyncIterator[StreamPart]: Asynchronous iterator of stream results.
@@ -1857,6 +1912,13 @@ class RunsClient:
1857
1912
  ```
1858
1913
 
1859
1914
  """ # noqa: E501
1915
+ if checkpoint_during is not None:
1916
+ warnings.warn(
1917
+ "`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
1918
+ DeprecationWarning,
1919
+ stacklevel=2,
1920
+ )
1921
+
1860
1922
  payload = {
1861
1923
  "input": input,
1862
1924
  "command": (
@@ -1881,6 +1943,7 @@ class RunsClient:
1881
1943
  "on_disconnect": on_disconnect,
1882
1944
  "on_completion": on_completion,
1883
1945
  "after_seconds": after_seconds,
1946
+ "durability": durability,
1884
1947
  }
1885
1948
  endpoint = (
1886
1949
  f"/threads/{thread_id}/runs/stream"
@@ -1971,7 +2034,7 @@ class RunsClient:
1971
2034
  context: Context | None = None,
1972
2035
  checkpoint: Checkpoint | None = None,
1973
2036
  checkpoint_id: str | None = None,
1974
- checkpoint_during: bool | None = None,
2037
+ checkpoint_during: bool | None = None, # deprecated
1975
2038
  interrupt_before: All | Sequence[str] | None = None,
1976
2039
  interrupt_after: All | Sequence[str] | None = None,
1977
2040
  webhook: str | None = None,
@@ -1982,6 +2045,7 @@ class RunsClient:
1982
2045
  headers: Mapping[str, str] | None = None,
1983
2046
  params: QueryParamTypes | None = None,
1984
2047
  on_run_created: Callable[[RunCreateMetadata], None] | None = None,
2048
+ durability: Durability | None = None,
1985
2049
  ) -> Run:
1986
2050
  """Create a background run.
1987
2051
 
@@ -2001,7 +2065,7 @@ class RunsClient:
2001
2065
  context: Static context to add to the assistant.
2002
2066
  !!! version-added "Supported with langgraph>=0.6.0"
2003
2067
  checkpoint: The checkpoint to resume from.
2004
- checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
2068
+ checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
2005
2069
  interrupt_before: Nodes to interrupt immediately before they get executed.
2006
2070
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
2007
2071
  webhook: Webhook to call after LangGraph API call is done.
@@ -2015,6 +2079,10 @@ class RunsClient:
2015
2079
  Use to schedule future runs.
2016
2080
  headers: Optional custom headers to include with the request.
2017
2081
  on_run_created: Optional callback to call when a run is created.
2082
+ durability: The durability to use for the run. Values are "sync", "async", or "exit".
2083
+ "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
2084
+ "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
2085
+ "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
2018
2086
 
2019
2087
  Returns:
2020
2088
  Run: The created background run.
@@ -2090,6 +2158,12 @@ class RunsClient:
2090
2158
  }
2091
2159
  ```
2092
2160
  """ # noqa: E501
2161
+ if checkpoint_during is not None:
2162
+ warnings.warn(
2163
+ "`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
2164
+ DeprecationWarning,
2165
+ stacklevel=2,
2166
+ )
2093
2167
  payload = {
2094
2168
  "input": input,
2095
2169
  "command": (
@@ -2112,6 +2186,7 @@ class RunsClient:
2112
2186
  "if_not_exists": if_not_exists,
2113
2187
  "on_completion": on_completion,
2114
2188
  "after_seconds": after_seconds,
2189
+ "durability": durability,
2115
2190
  }
2116
2191
  payload = {k: v for k, v in payload.items() if v is not None}
2117
2192
 
@@ -2209,7 +2284,7 @@ class RunsClient:
2209
2284
  context: Context | None = None,
2210
2285
  checkpoint: Checkpoint | None = None,
2211
2286
  checkpoint_id: str | None = None,
2212
- checkpoint_during: bool | None = None,
2287
+ checkpoint_during: bool | None = None, # deprecated
2213
2288
  interrupt_before: All | Sequence[str] | None = None,
2214
2289
  interrupt_after: All | Sequence[str] | None = None,
2215
2290
  webhook: str | None = None,
@@ -2222,6 +2297,7 @@ class RunsClient:
2222
2297
  headers: Mapping[str, str] | None = None,
2223
2298
  params: QueryParamTypes | None = None,
2224
2299
  on_run_created: Callable[[RunCreateMetadata], None] | None = None,
2300
+ durability: Durability | None = None,
2225
2301
  ) -> list[dict] | dict[str, Any]:
2226
2302
  """Create a run, wait until it finishes and return the final state.
2227
2303
 
@@ -2237,7 +2313,7 @@ class RunsClient:
2237
2313
  context: Static context to add to the assistant.
2238
2314
  !!! version-added "Supported with langgraph>=0.6.0"
2239
2315
  checkpoint: The checkpoint to resume from.
2240
- checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
2316
+ checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
2241
2317
  interrupt_before: Nodes to interrupt immediately before they get executed.
2242
2318
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
2243
2319
  webhook: Webhook to call after LangGraph API call is done.
@@ -2253,6 +2329,10 @@ class RunsClient:
2253
2329
  Use to schedule future runs.
2254
2330
  headers: Optional custom headers to include with the request.
2255
2331
  on_run_created: Optional callback to call when a run is created.
2332
+ durability: The durability to use for the run. Values are "sync", "async", or "exit".
2333
+ "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
2334
+ "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
2335
+ "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
2256
2336
 
2257
2337
  Returns:
2258
2338
  Union[list[dict], dict[str, Any]]: The output of the run.
@@ -2306,6 +2386,12 @@ class RunsClient:
2306
2386
  ```
2307
2387
 
2308
2388
  """ # noqa: E501
2389
+ if checkpoint_during is not None:
2390
+ warnings.warn(
2391
+ "`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
2392
+ DeprecationWarning,
2393
+ stacklevel=2,
2394
+ )
2309
2395
  payload = {
2310
2396
  "input": input,
2311
2397
  "command": (
@@ -2326,6 +2412,7 @@ class RunsClient:
2326
2412
  "on_disconnect": on_disconnect,
2327
2413
  "on_completion": on_completion,
2328
2414
  "after_seconds": after_seconds,
2415
+ "durability": durability,
2329
2416
  }
2330
2417
  endpoint = (
2331
2418
  f"/threads/{thread_id}/runs/wait" if thread_id is not None else "/runs/wait"
@@ -4733,6 +4820,54 @@ class SyncThreadsClient:
4733
4820
  params=params,
4734
4821
  )
4735
4822
 
4823
+ def join_stream(
4824
+ self,
4825
+ thread_id: str,
4826
+ *,
4827
+ stream_mode: ThreadStreamMode | Sequence[ThreadStreamMode] = "run_modes",
4828
+ last_event_id: str | None = None,
4829
+ headers: Mapping[str, str] | None = None,
4830
+ params: QueryParamTypes | None = None,
4831
+ ) -> Iterator[StreamPart]:
4832
+ """Get a stream of events for a thread.
4833
+
4834
+ Args:
4835
+ thread_id: The ID of the thread to get the stream for.
4836
+ last_event_id: The ID of the last event to get.
4837
+ headers: Optional custom headers to include with the request.
4838
+ params: Optional query parameters to include with the request.
4839
+
4840
+ Returns:
4841
+ Iterator[StreamPart]: An iterator of stream parts.
4842
+
4843
+ ???+ example "Example Usage"
4844
+
4845
+ ```python
4846
+
4847
+ for chunk in client.threads.join_stream(
4848
+ thread_id="my_thread_id",
4849
+ last_event_id="my_event_id",
4850
+ stream_mode="run_modes",
4851
+ ):
4852
+ print(chunk)
4853
+ ```
4854
+
4855
+ """ # noqa: E501
4856
+ query_params = {
4857
+ "stream_mode": stream_mode,
4858
+ }
4859
+ if params:
4860
+ query_params.update(params)
4861
+ return self.http.stream(
4862
+ f"/threads/{thread_id}/stream",
4863
+ "GET",
4864
+ headers={
4865
+ **({"Last-Event-ID": last_event_id} if last_event_id else {}),
4866
+ **(headers or {}),
4867
+ },
4868
+ params=query_params,
4869
+ )
4870
+
4736
4871
 
4737
4872
  class SyncRunsClient:
4738
4873
  """Synchronous client for managing runs in LangGraph.
@@ -4823,7 +4958,7 @@ class SyncRunsClient:
4823
4958
  context: Context | None = None,
4824
4959
  checkpoint: Checkpoint | None = None,
4825
4960
  checkpoint_id: str | None = None,
4826
- checkpoint_during: bool | None = None,
4961
+ checkpoint_during: bool | None = None, # deprecated
4827
4962
  interrupt_before: All | Sequence[str] | None = None,
4828
4963
  interrupt_after: All | Sequence[str] | None = None,
4829
4964
  feedback_keys: Sequence[str] | None = None,
@@ -4836,6 +4971,7 @@ class SyncRunsClient:
4836
4971
  headers: Mapping[str, str] | None = None,
4837
4972
  params: QueryParamTypes | None = None,
4838
4973
  on_run_created: Callable[[RunCreateMetadata], None] | None = None,
4974
+ durability: Durability | None = None,
4839
4975
  ) -> Iterator[StreamPart]:
4840
4976
  """Create a run and stream the results.
4841
4977
 
@@ -4855,7 +4991,7 @@ class SyncRunsClient:
4855
4991
  context: Static context to add to the assistant.
4856
4992
  !!! version-added "Supported with langgraph>=0.6.0"
4857
4993
  checkpoint: The checkpoint to resume from.
4858
- checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
4994
+ checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
4859
4995
  interrupt_before: Nodes to interrupt immediately before they get executed.
4860
4996
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
4861
4997
  feedback_keys: Feedback keys to assign to run.
@@ -4872,6 +5008,11 @@ class SyncRunsClient:
4872
5008
  Use to schedule future runs.
4873
5009
  headers: Optional custom headers to include with the request.
4874
5010
  on_run_created: Optional callback to call when a run is created.
5011
+ durability: The durability to use for the run. Values are "sync", "async", or "exit".
5012
+ "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
5013
+ "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
5014
+ "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
5015
+
4875
5016
 
4876
5017
  Returns:
4877
5018
  Iterator[StreamPart]: Iterator of stream results.
@@ -4904,6 +5045,12 @@ class SyncRunsClient:
4904
5045
  StreamPart(event='end', data=None)
4905
5046
  ```
4906
5047
  """ # noqa: E501
5048
+ if checkpoint_during is not None:
5049
+ warnings.warn(
5050
+ "`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
5051
+ DeprecationWarning,
5052
+ stacklevel=2,
5053
+ )
4907
5054
  payload = {
4908
5055
  "input": input,
4909
5056
  "command": (
@@ -4928,6 +5075,7 @@ class SyncRunsClient:
4928
5075
  "on_disconnect": on_disconnect,
4929
5076
  "on_completion": on_completion,
4930
5077
  "after_seconds": after_seconds,
5078
+ "durability": durability,
4931
5079
  }
4932
5080
  endpoint = (
4933
5081
  f"/threads/{thread_id}/runs/stream"
@@ -5018,7 +5166,7 @@ class SyncRunsClient:
5018
5166
  context: Context | None = None,
5019
5167
  checkpoint: Checkpoint | None = None,
5020
5168
  checkpoint_id: str | None = None,
5021
- checkpoint_during: bool | None = None,
5169
+ checkpoint_during: bool | None = None, # deprecated
5022
5170
  interrupt_before: All | Sequence[str] | None = None,
5023
5171
  interrupt_after: All | Sequence[str] | None = None,
5024
5172
  webhook: str | None = None,
@@ -5029,6 +5177,7 @@ class SyncRunsClient:
5029
5177
  headers: Mapping[str, str] | None = None,
5030
5178
  params: QueryParamTypes | None = None,
5031
5179
  on_run_created: Callable[[RunCreateMetadata], None] | None = None,
5180
+ durability: Durability | None = None,
5032
5181
  ) -> Run:
5033
5182
  """Create a background run.
5034
5183
 
@@ -5048,7 +5197,7 @@ class SyncRunsClient:
5048
5197
  context: Static context to add to the assistant.
5049
5198
  !!! version-added "Supported with langgraph>=0.6.0"
5050
5199
  checkpoint: The checkpoint to resume from.
5051
- checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
5200
+ checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
5052
5201
  interrupt_before: Nodes to interrupt immediately before they get executed.
5053
5202
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
5054
5203
  webhook: Webhook to call after LangGraph API call is done.
@@ -5062,6 +5211,10 @@ class SyncRunsClient:
5062
5211
  Use to schedule future runs.
5063
5212
  headers: Optional custom headers to include with the request.
5064
5213
  on_run_created: Optional callback to call when a run is created.
5214
+ durability: The durability to use for the run. Values are "sync", "async", or "exit".
5215
+ "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
5216
+ "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
5217
+ "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
5065
5218
 
5066
5219
  Returns:
5067
5220
  Run: The created background run.
@@ -5137,6 +5290,12 @@ class SyncRunsClient:
5137
5290
  }
5138
5291
  ```
5139
5292
  """ # noqa: E501
5293
+ if checkpoint_during is not None:
5294
+ warnings.warn(
5295
+ "`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
5296
+ DeprecationWarning,
5297
+ stacklevel=2,
5298
+ )
5140
5299
  payload = {
5141
5300
  "input": input,
5142
5301
  "command": (
@@ -5159,6 +5318,7 @@ class SyncRunsClient:
5159
5318
  "if_not_exists": if_not_exists,
5160
5319
  "on_completion": on_completion,
5161
5320
  "after_seconds": after_seconds,
5321
+ "durability": durability,
5162
5322
  }
5163
5323
  payload = {k: v for k, v in payload.items() if v is not None}
5164
5324
 
@@ -5254,7 +5414,7 @@ class SyncRunsClient:
5254
5414
  metadata: Mapping[str, Any] | None = None,
5255
5415
  config: Config | None = None,
5256
5416
  context: Context | None = None,
5257
- checkpoint_during: bool | None = None,
5417
+ checkpoint_during: bool | None = None, # deprecated
5258
5418
  checkpoint: Checkpoint | None = None,
5259
5419
  checkpoint_id: str | None = None,
5260
5420
  interrupt_before: All | Sequence[str] | None = None,
@@ -5269,6 +5429,7 @@ class SyncRunsClient:
5269
5429
  headers: Mapping[str, str] | None = None,
5270
5430
  params: QueryParamTypes | None = None,
5271
5431
  on_run_created: Callable[[RunCreateMetadata], None] | None = None,
5432
+ durability: Durability | None = None,
5272
5433
  ) -> list[dict] | dict[str, Any]:
5273
5434
  """Create a run, wait until it finishes and return the final state.
5274
5435
 
@@ -5284,7 +5445,7 @@ class SyncRunsClient:
5284
5445
  context: Static context to add to the assistant.
5285
5446
  !!! version-added "Supported with langgraph>=0.6.0"
5286
5447
  checkpoint: The checkpoint to resume from.
5287
- checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
5448
+ checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
5288
5449
  interrupt_before: Nodes to interrupt immediately before they get executed.
5289
5450
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
5290
5451
  webhook: Webhook to call after LangGraph API call is done.
@@ -5301,6 +5462,10 @@ class SyncRunsClient:
5301
5462
  raise_error: Whether to raise an error if the run fails.
5302
5463
  headers: Optional custom headers to include with the request.
5303
5464
  on_run_created: Optional callback to call when a run is created.
5465
+ durability: The durability to use for the run. Values are "sync", "async", or "exit".
5466
+ "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
5467
+ "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
5468
+ "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
5304
5469
 
5305
5470
  Returns:
5306
5471
  Union[list[dict], dict[str, Any]]: The output of the run.
@@ -5355,6 +5520,12 @@ class SyncRunsClient:
5355
5520
  ```
5356
5521
 
5357
5522
  """ # noqa: E501
5523
+ if checkpoint_during is not None:
5524
+ warnings.warn(
5525
+ "`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
5526
+ DeprecationWarning,
5527
+ stacklevel=2,
5528
+ )
5358
5529
  payload = {
5359
5530
  "input": input,
5360
5531
  "command": (
@@ -5376,6 +5547,7 @@ class SyncRunsClient:
5376
5547
  "on_completion": on_completion,
5377
5548
  "after_seconds": after_seconds,
5378
5549
  "raise_error": raise_error,
5550
+ "durability": durability,
5379
5551
  }
5380
5552
 
5381
5553
  def on_response(res: httpx.Response):
@@ -38,6 +38,14 @@ Represents the status of a thread:
38
38
  - "error": An exception occurred during task processing.
39
39
  """
40
40
 
41
+ ThreadStreamMode = Literal["run_modes", "lifecycle", "state_update"]
42
+ """
43
+ Defines the mode of streaming:
44
+ - "run_modes": Stream the same events as the runs on thread, as well as run_done events.
45
+ - "lifecycle": Stream only run start/end events.
46
+ - "state_update": Stream state updates on the thread.
47
+ """
48
+
41
49
  StreamMode = Literal[
42
50
  "values",
43
51
  "messages",
@@ -91,6 +99,12 @@ Defines action after completion:
91
99
  - "keep": Retain resources after completion.
92
100
  """
93
101
 
102
+ Durability = Literal["sync", "async", "exit"]
103
+ """Durability mode for the graph execution.
104
+ - `"sync"`: Changes are persisted synchronously before the next step starts.
105
+ - `"async"`: Changes are persisted asynchronously while the next step executes.
106
+ - `"exit"`: Changes are persisted only when the graph exits."""
107
+
94
108
  All = Literal["*"]
95
109
  """Represents a wildcard or 'all' selector."""
96
110
 
File without changes
File without changes
File without changes
File without changes
File without changes