You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/oss/langgraph/durable-execution.mdx
+16-34Lines changed: 16 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,40 +52,7 @@ how to structure your code using **tasks** to avoid these issues. The same princ
52
52
53
53
## Durability modes
54
54
55
-
LangGraph supports three durability modes that allow you to balance performance and data consistency based on your application's requirements. The durability modes, from least to most durable, are as follows:
56
-
57
-
*[`"exit"`](#exit)
58
-
*[`"async"`](#async)
59
-
*[`"sync"`](#sync)
60
-
61
-
A higher durability mode adds more overhead to the workflow execution.
62
-
63
-
<Tip>
64
-
**Added in v0.6.0**
65
-
Use the `durability` parameter instead of `checkpoint_during` (deprecated in v0.6.0) for persistence policy management:
for persistence policy management, with the following mapping:
71
-
72
-
*`checkpoint_during=True` -> `durability="async"`
73
-
*`checkpoint_during=False` -> `durability="exit"`
74
-
</Tip>
75
-
76
-
### `"exit"`
77
-
78
-
Changes are persisted only when graph execution completes (either successfully or with an error). This provides the best performance for long-running graphs but means intermediate state is not saved, so you cannot recover from mid-execution failures or interrupt the graph execution.
79
-
80
-
### `"async"`
81
-
82
-
Changes are persisted asynchronously while the next step executes. This provides good performance and durability, but there's a small risk that checkpoints might not be written if the process crashes during execution.
83
-
84
-
### `"sync"`
85
-
86
-
Changes are persisted synchronously before the next step starts. This ensures that every checkpoint is written before continuing execution, providing high durability at the cost of some performance overhead.
87
-
88
-
You can specify the durability mode when calling any graph execution method:
55
+
LangGraph supports three durability modes that allow you to balance performance and data consistency based on your application's requirements. A higher durability mode adds more overhead to the workflow execution. You can specify the durability mode when calling any graph execution method:
89
56
90
57
:::python
91
58
```python
@@ -96,6 +63,21 @@ graph.stream(
96
63
```
97
64
:::
98
65
66
+
:::js
67
+
```typescript
68
+
graph.stream(
69
+
{"input": "test"},
70
+
durability="sync"
71
+
)
72
+
```
73
+
:::
74
+
75
+
The durability modes, from least to most durable, are as follows:
76
+
77
+
*`"exit"`: Changes are persisted only when graph execution completes (either successfully or with an error). This provides the best performance for long-running graphs but means intermediate state is not saved, so you cannot recover from mid-execution failures or interrupt the graph execution.
78
+
*`"async"`: Changes are persisted asynchronously while the next step executes. This provides good performance and durability, but there's a small risk that checkpoints might not be written if the process crashes during execution.
79
+
*`"sync"`: Changes are persisted synchronously before the next step starts. This ensures that every checkpoint is written before continuing execution, providing high durability at the cost of some performance overhead.
80
+
99
81
## Using tasks in nodes
100
82
101
83
If a [node](/oss/langgraph/graph-api#nodes) contains multiple operations, you may find it easier to convert each operation into a **task** rather than refactor the operations into individual nodes.
0 commit comments