# Is an activity wrapped in async function called via asyncio.gather still deterministic?

**URL:** <https://community.temporal.io/t/is-an-activity-wrapped-in-async-function-called-via-asyncio-gather-still-deterministic/19713>\
**Category:** Community Support\
**Tags:** python-sdk\
**Created:** [July 6, 2026, 4:55pm UTC](https://community.temporal.io/t/is-an-activity-wrapped-in-async-function-called-via-asyncio-gather-still-deterministic/19713 "2026-07-06T16:55:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ustulation](https://avatars.discourse-cdn.com/v4/letter/u/9de053/32.png) [@ustulation](https://community.temporal.io/u/ustulation)\
**Post date:** [July 6, 2026, 4:55pm UTC](https://community.temporal.io/t/is-an-activity-wrapped-in-async-function-called-via-asyncio-gather-still-deterministic/19713/1 "2026-07-06T16:55:17Z")

</div>

```auto
async def helper0(self):
    self.counter += 1
    if self.counter == 1:
        await execute(activity-foo)
    else:
        await execute(activity-bar)

async def helper1(self):
    self.counter += 1
    if self.counter == 1:
        await execute(activity-abc)
    else:
        await execute(activity-xyz)

await asyncio.gather(helper0(), helper1())

```

Since `asyncio.gather` doesn’t guarantee the invocation order (only that returned result will be ordered as given), different runs can see different values of self.counter depending on whether helper0 was scheduled 1st or helper1.

Will temporal have a problem with this? Or does it do some magic behind the scenes to tackle this (eg. by monkey patching asyncio.gather to their own version etc)?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [July 7, 2026, 11:36pm UTC](https://community.temporal.io/t/is-an-activity-wrapped-in-async-function-called-via-asyncio-gather-still-deterministic/19713/2 "2026-07-07T23:36:43Z")

</div>

Temporal implements deterministic asyncio scheduler. So asyncio.gather is deterministic.

asyncio.as\_completed and asyncio.wait are not.

See [sdk-python/README.md at main · temporalio/sdk-python · GitHub](https://github.com/temporalio/sdk-python/blob/main/README.md#asyncio-and-determinism)
