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
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,35 @@ Orchestrations are implemented using ordinary Python functions that take an `Orc
138
138
139
139
Activities are implemented using ordinary Python functions that take an `ActivityContext` as their first parameter. Activity functions are scheduled by orchestrations and have at-least-once execution guarantees, meaning that they will be executed at least once but may be executed multiple times in the event of a transient failure. Activity functions are where the real "work" of any orchestration is done.
140
140
141
+
#### Async Activities
142
+
143
+
Activities can be either synchronous or asynchronous functions. Async activities are useful for I/O-bound operations like HTTP requests, database queries, or file operations:
asyncwith session.get(f"https://api.example.com/{data}") as response:
157
+
result =await response.json()
158
+
return result
159
+
```
160
+
161
+
Both sync and async activities are registered the same way:
162
+
163
+
```python
164
+
worker.add_activity(sync_activity)
165
+
worker.add_activity(async_activity)
166
+
```
167
+
168
+
Orchestrators call them identically regardless of whether they're sync or async - the SDK handles the execution automatically.
169
+
141
170
### Durable timers
142
171
143
172
Orchestrations can schedule durable timers using the `create_timer` API. These timers are durable, meaning that they will survive orchestrator restarts and will fire even if the orchestrator is not actively in memory. Durable timers can be of any duration, from milliseconds to months.
Copy file name to clipboardExpand all lines: durabletask/aio/ASYNCIO_INTERNALS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -292,7 +292,7 @@ Adding sandbox coverage:
292
292
293
293
## Interop Checklist (Async ↔ Generator)
294
294
295
-
- Activities: identical behavior; only authoring differs (`yield` vs `await`).
295
+
- Activities: identical behavior; only authoring differs (`yield` vs `await`). Activities themselves can be either sync or async functions and work identically from both generator and async orchestrators.
296
296
- Timers: map to the same `createTimer` actions.
297
297
- External events: same semantics for buffering and completion.
298
298
- Sub‑orchestrators: same create/complete/fail events.
0 commit comments