René's URL Explorer Experiment


Title: Support `async def` activities in the core worker · Issue #319 · microsoft/durabletask-python · GitHub

Open Graph Title: Support `async def` activities in the core worker · Issue #319 · microsoft/durabletask-python

X Title: Support `async def` activities in the core worker · Issue #319 · microsoft/durabletask-python

Description: Problem Registering an async def activity with TaskHubGrpcWorker (or DurableTaskSchedulerWorker) fails at runtime. The activity executor calls the function without awaiting it, and the data converter then tries to serialize the coroutine...

Open Graph Description: Problem Registering an async def activity with TaskHubGrpcWorker (or DurableTaskSchedulerWorker) fails at runtime. The activity executor calls the function without awaiting it, and the data convert...

X Description: Problem Registering an async def activity with TaskHubGrpcWorker (or DurableTaskSchedulerWorker) fails at runtime. The activity executor calls the function without awaiting it, and the data convert...

Opengraph URL: https://github.com/microsoft/durabletask-python/issues/319

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support `async def` activities in the core worker","articleBody":"## Problem\n\nRegistering an `async def` activity with `TaskHubGrpcWorker` (or `DurableTaskSchedulerWorker`) fails at runtime. The activity executor calls the function without awaiting it, and the data converter then tries to serialize the coroutine:\n\n```python\nasync def fetch(ctx: task.ActivityContext, city: str) -> float:\n    async with httpx.AsyncClient() as client:\n        ...\n\nworker.add_activity(fetch)\n# Activity task #1 failed: Failed to serialize object of type 'coroutine' to JSON:\n# Object of type 'coroutine' is not JSON serializable\n```\n\nPython also emits `RuntimeWarning: coroutine 'fetch' was never awaited`.\n\nThe only workaround today is a sync activity that calls `asyncio.run(...)`. That holds a worker thread for the whole I/O wait and creates a new event loop per call, even though the worker already runs its own loop and `_AsyncWorkerManager` can await coroutine work items.\n\n## Why\n\n- I/O-bound activities (HTTP calls, async database drivers, Azure SDK `aio` clients) are the common case. With async activities they no longer occupy a thread from `maximum_thread_pool_workers` while they wait.\n- The Azure Functions provider in this repo already accepts `async def` activities (`azure-functions-durable/.../internal/compat/activity.py` checks `inspect.iscoroutinefunction`). The core worker is the remaining gap.\n- #294 adds async/await support for **orchestrators**. Activities are a separate code path and are not covered there, so this complements it without overlapping.\n\n## Proposed design\n\n- If an activity is a coroutine function (or a callable object with an `async def __call__`), the worker runs it on its event loop and awaits it. Sync activities keep their existing thread pool path unchanged.\n- Concurrency stays bounded by `ConcurrencyOptions.maximum_concurrent_activity_work_items`, as it is today.\n- Tracing, failure details and the activity execution hooks behave the same on both paths. Blocking calls (payload store, `CompleteActivityTask`) are moved off the loop with `asyncio.to_thread`.\n- `call_activity()` gets an overload so an async activity's task is typed with the awaited result instead of a coroutine.\n- A sync activity that returns an awaitable fails with a clear `TypeError` (use `async def`) instead of the serialization error above.\n\nNo public API is removed, and no package version or dependency changes.\n\nI have an implementation with tests ready and will open a PR referencing this issue. Happy to adjust the design if you'd prefer a different approach, for example aligning it with #293.\n","author":{"url":"https://github.com/KSouleymane","@type":"Person","name":"KSouleymane"},"datePublished":"2026-11-02T18:15:35Z","url":"https://github.com/microsoft/durabletask-python/issues/319"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e278c2de-776f-f962-00c7-081c537f0282
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE260:78925:69176:9327D:6AFE1E8B
html-safe-nonce0ed8078b207cd46bfd3120bd4e04fe4435bb2f01b38d641fdef2e29fc88af913
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjYwOjc4OTI1OjY5MTc2OjkzMjdEOjZBRkUxRThCIiwidmlzaXRvcl9pZCI6IjEwMzYzODAwNzI3OTA4NTk0MDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace0835b5f0d6e265ae6d48a758b2f0c9c3f95fcec0689478ca3dea567caec200c
hovercard-subject-tagissue:6168341388
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/durabletask-python/319/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3e2335be42bb857236a53e6fbbaa989545a4771afbc61904afc77484e738c285/microsoft/durabletask-python/issues/319
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3e2335be42bb857236a53e6fbbaa989545a4771afbc61904afc77484e738c285/microsoft/durabletask-python/issues/319
og:image:altProblem Registering an async def activity with TaskHubGrpcWorker (or DurableTaskSchedulerWorker) fails at runtime. The activity executor calls the function without awaiting it, and the data convert...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameKSouleymane
hostnamegithub.com
expected-hostnamegithub.com
Noned0525ab1464526bf4532a5551aa348cf100dff75ef808a96fc67a08b1d946aa9
turbo-cache-controlno-preview
go-importgithub.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id627664515
octolytics-dimension-repository_nwomicrosoft/durabletask-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627664515
octolytics-dimension-repository_network_root_nwomicrosoft/durabletask-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasefef3993a71fa20f7be8e167132fbf9619bc66e12
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/durabletask-python/issues/319#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fissues%2F319
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fissues%2F319
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2Fdurabletask-python
Reloadhttps://github.com/microsoft/durabletask-python/issues/319
Reloadhttps://github.com/microsoft/durabletask-python/issues/319
Reloadhttps://github.com/microsoft/durabletask-python/issues/319
microsofthttps://github.com/microsoft
durabletask-pythonhttps://github.com/microsoft/durabletask-python
Codehttps://github.com/microsoft/durabletask-python
Issues15 (15)https://github.com/microsoft/durabletask-python/issues
Pull requests12 (12)https://github.com/microsoft/durabletask-python/pulls
Actionshttps://github.com/microsoft/durabletask-python/actions
Projectshttps://github.com/microsoft/durabletask-python/projects
Security and qualityhttps://github.com/microsoft/durabletask-python/security
Insightshttps://github.com/microsoft/durabletask-python/insights
https://github.com/microsoft/durabletask-python
New issuehttps://github.com/login?return_to=https://github.com/microsoft/durabletask-python/issues/319
New issuehttps://github.com/login?return_to=https://github.com/microsoft/durabletask-python/issues/319
#320https://github.com/microsoft/durabletask-python/pull/320
Support async def activities in the core workerhttps://github.com/microsoft/durabletask-python/issues/319#top
#320https://github.com/microsoft/durabletask-python/pull/320
enhancementNew feature or requesthttps://github.com/microsoft/durabletask-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/KSouleymane
KSouleymanehttps://github.com/KSouleymane
on Nov 2, 2026https://github.com/microsoft/durabletask-python/issues/319#issue-6168341388
Support async/await orchestrators across the Python SDK packages #294https://github.com/microsoft/durabletask-python/issues/294
#293https://github.com/microsoft/durabletask-python/pull/293
https://github.com/berndverst
Bernd Verst (berndverst)https://github.com/berndverst
on Nov 2, 2026https://github.com/microsoft/durabletask-python/issues/319#issuecomment-6585795772
#294https://github.com/microsoft/durabletask-python/issues/294
#293https://github.com/microsoft/durabletask-python/pull/293
andystapleshttps://github.com/andystaples
enhancementNew feature or requesthttps://github.com/microsoft/durabletask-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
on Nov 11, 2026https://github.com/microsoft/durabletask-python/issues/319#event-35834451764
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/durabletask-python/issues/319
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/durabletask-python/issues/319
enhancementNew feature or requesthttps://github.com/microsoft/durabletask-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.