@@ -186,6 +186,54 @@ receipt = yield ctx.start_child_workflow(
186186)
187187```
188188
189+ ## Deterministic parallel groups
190+
191+ Yield a list to schedule one durable parallel barrier. Lists can nest and mix
192+ activities, child workflows, and timers. The worker flattens only the Server
193+ commands, records a stable full ` parallel_group_path ` on every leaf, and
194+ returns results in the original nested input shape regardless of terminal
195+ delivery order:
196+
197+ ``` python
198+ results = yield [
199+ ctx.schedule_activity(" load-profile" , [customer_id]),
200+ [
201+ ctx.start_child_workflow(" quote-shipping" , [customer_id]),
202+ ctx.start_timer(5 ),
203+ ],
204+ ]
205+ profile, (shipping, _) = results
206+ ```
207+
208+ One failed activity or child is thrown at the list-yield point by durable input
209+ position. Already recorded sibling completions remain replayable; late and
210+ exact duplicate terminal deliveries do not change the selected result.
211+
212+ ## Saga compensation
213+
214+ ` ctx.saga() ` registers ordinary activity commands as compensations and runs
215+ them sequentially in reverse registration order after failure or cooperative
216+ cancellation:
217+
218+ ``` python
219+ def forward (saga ):
220+ flight = yield ctx.schedule_activity(" trip.reserve-flight" , [])
221+ saga.add_compensation(" trip.cancel-flight" , [flight])
222+
223+ hotel = yield ctx.schedule_activity(" trip.reserve-hotel" , [])
224+ saga.add_compensation(" trip.cancel-hotel" , [hotel])
225+
226+ ctx.throw_if_cancellation_requested()
227+ yield ctx.schedule_activity(" trip.charge" , [])
228+ return {" status" : " booked" }
229+
230+ return (yield from ctx.saga().run(forward))
231+ ```
232+
233+ Compensation stops at its first failure. ` SagaCompensationFailed ` retains the
234+ initiating failure, compensation failure, activity type, and deterministic
235+ registration order as structured fields.
236+
189237## Nexus service calls
190238
191239Workflow code can call a registered Nexus service operation through
0 commit comments