# temporalio

> Temporal.io Python SDK

- **URL**: https://www.freshcrate.ai/projects/temporalio
- **Author**: pypi
- **Category**: Frameworks
- **Latest version**: `1.28.0` (2026-06-04)
- **License**: Unknown
- **Source**: https://github.com/temporalio/sdk-python/issues
- **Homepage**: https://pypi.org/project/temporalio/
- **Language**: Python
- **GitHub**: 1,047 stars, 175 forks
- **Registry**: pypi (`temporalio`)
- **Tags**: `pypi`, `temporal`, `workflow`

## Description

![Temporal Python SDK](https://assets.temporal.io/w/py-banner.svg)

[![Python 3.9+](https://img.shields.io/pypi/pyversions/temporalio.svg?style=for-the-badge)](https://pypi.org/project/temporalio)
[![PyPI](https://img.shields.io/pypi/v/temporalio.svg?style=for-the-badge)](https://pypi.org/project/temporalio)
[![MIT](https://img.shields.io/pypi/l/temporalio.svg?style=for-the-badge)](LICENSE)

**📣 News: Integration between OpenAI Agents SDK and Temporal is now in public preview. [Learn more](temporalio/contrib/openai_agents/README.md).**

[Temporal](https://temporal.io/) is a distributed, scalable, durable, and highly available orchestration engine used to
execute asynchronous, long-running business logic in a scalable and resilient way.

"Temporal Python SDK" is the framework for authoring workflows and activities using the Python programming language.

Also see:
* [Application Development Guide](https://docs.temporal.io/application-development?lang=python) - Once you've tried our
  [Quick Start](#quick-start), check out our guide on how to use Temporal in your Python applications, including
  information around Temporal core concepts.
* [Python Code Samples](https://github.com/temporalio/samples-python)
* [API Documentation](https://python.temporal.io) - Complete Temporal Python SDK Package reference.

In addition to features common across all Temporal SDKs, the Python SDK also has the following interesting features:

**Type Safe**

This library uses the latest typing and MyPy support with generics to ensure all calls can be typed. For example,
starting a workflow with an `int` parameter when it accepts a `str` parameter would cause MyPy to fail.

**Different Activity Types**

The activity worker has been developed to work with `async def`, threaded, and multiprocess activities. Threaded activities are the initial recommendation, and further guidance can be found in [the docs](https://docs.temporal.io/develop/python/python-sdk-sync-vs-async).

**Custom `asyncio` Event Loop**

The workflow implementation basically turns `async def` functions into workflows backed by a distributed, fault-tolerant
event loop. This means task management, sleep, cancellation, etc have all been developed to seamlessly integrate with
`asyncio` concepts.

See the [blog post](https://temporal.io/blog/durable-distributed-asyncio-event-loop) introducing the Python SDK for an
informal introduction to the features and their implementation.

---

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Contents**

- [Quick Start](#quick-start)
  - [Installation](#installation)
  - [Implementing a Workflow](#implementing-a-workflow)
  - [Running a Workflow](#running-a-workflow)
  - [Next Steps](#next-steps)
- [Usage](#usage)
    - [Client](#client)
      - [Data Conversion](#data-conversion)
        - [Pydantic Support](#pydantic-support)
        - [Custom Type Data Conversion](#custom-type-data-conversion)
        - [External Storage](#external-storage)
          - [Driver Selection](#driver-selection)
          - [Built-in Drivers](#built-in-drivers)
          - [Custom Drivers](#custom-drivers)
    - [Workers](#workers)
    - [Workflows](#workflows)
      - [Definition](#definition)
      - [Running](#running)
      - [Invoking Activities](#invoking-activities)
      - [Invoking Child Workflows](#invoking-child-workflows)
      - [Timers](#timers)
      - [Conditions](#conditions)
      - [Asyncio and Determinism](#asyncio-and-determinism)
      - [Asyncio Cancellation](#asyncio-cancellation)
      - [Workflow Utilities](#workflow-utilities)
      - [Exceptions](#exceptions)
      - [Signal and update handlers](#signal-and-update-handlers)
      - [External Workflows](#external-workflows)
      - [Testing](#testing)
        - [Automatic Time Skipping](#automatic-time-skipping)
        - [Manual Time Skipping](#manual-time-skipping)
        - [Mocking Activities](#mocking-activities)
      - [Workflow Sandbox](#workflow-sandbox)
        - [How the Sandbox Works](#how-the-sandbox-works)
        - [Avoiding the Sandbox](#avoiding-the-sandbox)
        - [Customizing the Sandbox](#customizing-the-sandbox)
          - [Passthrough Modules](#passthrough-modules)
          - [Invalid Module Members](#invalid-module-members)
        - [Known Sandbox Issues](#known-sandbox-issues)
          - [Global Import/Builtins](#global-importbuiltins)
          - [Sandbox is not Secure](#sandbox-is-not-secure)
          - [Sandbox Performance](#sandbox-performance)
          - [Extending Restricted Classes](#extending-restricted-classes)
          - [Certain Standard Library Calls on Restricted Objects](#certain-standard-library-calls-on-restricted-objects)
          - [is_subclass of ABC-based Restricted Classes](#is_subclass-of-abc-based-restricted-classes)
    - [Activities](#activities)
      - [Definition](#definition-1)
      - [Types of Activities](#types-o

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `1.28.0` | 2026-06-04 | High | ## Experimental Releases ### Strands Agents Plugin This release adds a new [Temporal Plugin](https://docs.temporal.io/develop/plugins-guide) for running [Strands Agents](https://strandsagents.com/) inside Temporal Workflows. Model invocations, tool calls, and MCP tool calls are routed through Temporal Activities, so your agents get durable execution, retries, and timeouts for free.  ### Workflow Streams support for LangGraph The [LangGraph plugin](https://github.com/temporalio/sdk-python/tr |
| `1.27.2` | 2026-05-14 | High | ## DNS Resolver Load Balancing Configuration A new load balancing feature was added in https://github.com/temporalio/sdk-rust/pull/1212 which has caused networking issues in certain networking setups. This is now disabled by default via the change listed below.  ## What's Changed * Default DNS lb config to None by @THardy98 in https://github.com/temporalio/sdk-python/pull/1518 |
| `1.27.0` | 2026-04-30 | High | ## 💥 External Storage Reference Format Change (Experimental) External storage reference event history format has been incompatibly changed from prerelease. New storage references are emitted in the new format starting with release. Support for the ability to retrieve references in the old format has been preserved. The prerelease format is deprecated and will be removed in a future release.  ## Workflow Streams This release adds [Workflow Streams](https://github.com/temporalio/sdk-python/tr |
| `1.26.0` | 2026-04-21 | Low | Imported from PyPI (1.26.0) |
| `1.25.0` | 2026-04-08 | Medium | ## Pre-release Features  ### Serverless Lambda Workers This release introduces a [package](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/aws/lambda_worker) which can be used together with upcoming changes to the Temporal server & cloud which allow you to run your worker in an AWS Lambda function which the server will invoke as-needed to process Workflow, Activity, and Nexus tasks - allowing you to do away with some of the operational burden of running a fleet of worker |
| `1.24.0` | 2026-03-23 | Medium | ## General Availability  - Nexus is now generally available and no longer experimental - OpenAI Agents SDK Integration is now generally available and no longer experimental  ## Pre-release  - New Integration with the Google ADK for running ADK agents in Temporal Workflows. https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/google_adk_agents  ## Breaking Changes  ### :boom: Add OpenTelemetry integration for OpenAI AgentsOpenAI/otel in https://github.com/temporalio/sd |
| `1.23.0` | 2026-02-18 | Low | ## :boom: Breaking Changes ### 💥 Experimental standalone activity support in https://github.com/temporalio/sdk-python/pull/1307 - `activity.Info` modified to make `workflow_id`, `workflow_namespace`, `workflow_run_id`, and `workflow_type` optional   - 💥 SLIGHT BREAKING CHANGE for those manually expecting non-None fields or manually creating the info for tests - `converter.BaseWorkflowSerializationContext` intermediate base class removed   - 💥 SLIGHT BREAKING CHANGE for those that may hav |
| `1.22.0` | 2026-02-03 | Low | ## Highlights * Deployment-based Worker Versioning APIs are in General Availability. * Environment Configuration is in General Availability.  ## What's Changed * Adds basedpyright support to `poe lint` by @tconley1428 in https://github.com/temporalio/sdk-python/pull/1240 * Remove stdlib_module_names test that is no longer relevant by @VegetarianOrc in https://github.com/temporalio/sdk-python/pull/1259 * Update sdk-core to incorporate 1.60.0 api release by @jmaeagle99 in https://github.com |
| `1.21.1` | 2025-12-19 | Low | [PyPI](https://pypi.org/project/temporalio/)  ## Bug Fixes  * Dynamic handlers now support `typing.Sequence` and `collections.abc.Sequence` for their third argument. * Add compatibility with OpenAI Agents SDK 0.6.4.  ## Specific Changes  2025-12-19 - 772050e - Add backward compatibility for dynamic handler signatures (#1258)                                       2025-12-19 - f0bd341 - OpenAI - Fix generics is instance (#1261) |
| `1.21.0` | 2025-12-18 | Low | [PyPI](https://pypi.org/project/temporalio/)  ## TLS Automatically Enabled When API Key Provided  When creating a `Client`, specifying the `api_key` option will now automatically enable TLS. Users that wish to use an API Key without TLS enabled must explicitly pass `tls=False` when creating their client. See [`Client.connect`](https://python.temporal.io/temporalio.client.Client.html#connect) for a detailed description of configuration options and behavior.   ## Highlights  * Core was up |

## Citation

- HTML: https://www.freshcrate.ai/projects/temporalio
- Markdown: https://www.freshcrate.ai/projects/temporalio.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/temporalio/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
