Skip to content

Commit 45921a7

Browse files
authored
Fix durability modes section (#1567)
Fixes DOC-464
1 parent aa4f4af commit 45921a7

File tree

1 file changed

+16
-34
lines changed

1 file changed

+16
-34
lines changed

src/oss/langgraph/durable-execution.mdx

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,40 +52,7 @@ how to structure your code using **tasks** to avoid these issues. The same princ
5252

5353
## Durability modes
5454

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:
66-
67-
* `durability="async"` replaces `checkpoint_during=True`
68-
* `durability="exit"` replaces `checkpoint_during=False`
69-
70-
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:
8956

9057
:::python
9158
```python
@@ -96,6 +63,21 @@ graph.stream(
9663
```
9764
:::
9865

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+
9981
## Using tasks in nodes
10082

10183
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

Comments
 (0)