Skip to content

Implement get_task_factory #1031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2025
Merged

Implement get_task_factory #1031

merged 1 commit into from
Aug 18, 2025

Conversation

dandavison
Copy link
Contributor

This PR implements get_task_factory on the workflow event loop.

This is good practice in general, and is needed when using anyio from within workflow code: https://github.com/agronholm/anyio/blob/b8e91a5cfe35c3b28f91ea8251674a871a7f4e26/src/anyio/_backends/_asyncio.py#L861

One situation when one needs to use anyio from within workflow code is when using the Python MCP SDK's mcp.ClientSession to make MCP calls from a Temporal workflow via a custom transport. See e.g. bergundy/nexus-mcp-python#1

@dandavison dandavison requested a review from a team as a code owner August 18, 2025 12:38
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we're ok having set_task_factory continue to remain unsupported?

@dandavison
Copy link
Contributor Author

I assume we're ok having set_task_factory continue to remain unsupported?

It's not needed for my purposes, so I'll leave it until there's a known use case.

@dandavison dandavison merged commit e2c0ced into main Aug 18, 2025
57 of 65 checks passed
@dandavison dandavison deleted the dan-9997-python-mcp-nexus branch August 18, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants