github temporalio/sdk-python 1.32.0

latest release: 1.33.0
28 days ago

Notable Changes

Added

  • Added temporalio.converter.create_payload_validation_error to create the
    non-retryable application error used when a converted payload fails validation.

  • Added experimental temporalio.contrib.opentelemetry.ReplaySafeMeterProvider and
    ReplaySafeLoggerProvider (and exported ReplaySafeTracerProvider): wrap an
    OpenTelemetry provider so metrics and log events recorded from workflow code (e.g. by
    Google ADK) are not duplicated on replay. GoogleAdkPlugin warns when a global OTel
    provider is not replay-safe.

  • Added LoggingConfig.format to select compact, pretty, or newline-delimited JSON output for
    Core logs written to the console.

  • Added the Runtime(disable_environment_info=...) option to control whether
    runtime, hosting, and platform information is included in worker heartbeats.

  • temporalio.workflow.uuid7() generates a determinism-safe, time-sortable
    UUIDv7 (RFC 9562) from workflow time and the workflow's deterministic random
    generator, complementing the existing workflow.uuid4()
    (#1450). The
    workflow sandbox now also restricts the non-deterministic uuid.uuid7()
    added to the standard library in Python 3.14, matching the existing
    uuid.uuid1()/uuid.uuid4() restrictions.

  • Experimental: TemporalOperationHandler can now use Standalone Activities as asynchronous
    Nexus Operation backing executions through TemporalNexusClient.start_activity.

  • Experimental: temporalio.contrib.openai_agents.temporal_worker_env_ref names an environment
    variable the worker reads for a hosted tool credential, keeping it out of workflow history.

  • Experimental: temporalio.contrib.openai_agents.TemporalWorkerEnvValue names an environment
    variable the worker reads for a sandbox environment value, keeping it out of workflow history.

  • Experimental: OpenAIAgentsPlugin(resolvable_worker_env_vars=...) allowlists the environment
    variable names a worker will read.

  • Experimental: temporalio.contrib.openai_agents.AllowAllWorkerEnvVars allowlists every
    environment variable name on the worker.

Changed

  • The opentelemetry and lambda-worker-otel extras now require
    opentelemetry-api/opentelemetry-sdk >= 1.26, matching what
    temporalio.contrib.opentelemetry already required in practice.
  • temporalio.contrib.pydantic converters now reuse Pydantic type adapters
    for repeated type hints instead of rebuilding their schemas for every
    payload, greatly speeding up decode of non-model hints such as discriminated
    unions (#1695). Up
    to 1024 type adapters are cached per converter instance by default, with
    least-recently-used eviction. To change the bound, pass
    max_cached_type_adapters to PydanticPayloadConverter (or
    PydanticJSONPlainPayloadConverter) from a nullary subclass used as the
    DataConverter.payload_converter_class; None makes the cache
    unbounded and zero disables caching.
  • A data converter can now report that it understood a Nexus operation's input
    but considers it invalid by raising a non-retryable ApplicationError of type
    PayloadValidationError while decoding it. Such a failure is reported to the
    caller as a BAD_REQUEST Nexus handler error with the message
    Invalid operation input, retaining the original error as its cause. Raised
    from a payload codec, that replaces a handler-side INTERNAL error; raised
    from a payload converter, the type was already BAD_REQUEST and only the
    message becomes specific to validation. Any other decode failure, and a
    retryable PayloadValidationError, keep their existing treatment.

💥 Breaking Changes

  • The openai-agents extra now requires openai-agents>=0.19.2,<0.20, up from >=0.17.5 with no
    upper bound.
  • temporalio.contrib.openai_agents now rejects a sandbox SandboxPathGrant bound to a
    host_path.
  • temporalio.contrib.openai_agents now rejects run_config.sandbox.session.

Fixed

  • create_payload_validation_error(None) now creates an application error with no
    details instead of encoding None as a detail.
  • Client header encoding no longer mutates interceptor-provided payloads, preventing
    update-with-start from encoding a shared header twice when
    HeaderCodecBehavior.CODEC is enabled (#1769).
  • temporalio.contrib.opentelemetry replay-safe spans now delegate
    Span.add_link to the wrapped span. Previously the wrapper inherited
    OpenTelemetry's non-abstract no-op default, silently dropping links added
    after span creation.
  • Standalone activity start requests now include a unique request ID so RPC retries are deduplicated.
  • OpenTelemetry trace and span IDs propagated by concurrent workers no longer
    interfere with each other, preserving the correct parent-child hierarchy.
  • The google-adk extra now depends on mcp, so fresh installs of
    temporalio[google-adk] can import temporalio.contrib.google_adk_agents
    without separately installing mcp. Previously the import failed with an
    ImportError because google.adk.tools.mcp_tool only exports McpToolset
    when mcp is installed.
  • temporalio.contrib.openai_agents no longer crashes when a plain dict
    is passed for run_config. (openai-agents >= 0.19.0 accepts dict run
    configs at its public runner API)

SDK Core

Changelog

Added

  • Core console logs can now be emitted as newline-delimited JSON when an SDK selects the JSON log
    format. Configured log filters continue to apply to JSON output.
  • Worker heartbeats now report the SDK runtime, hosting environments, operating system, and
    architecture once per worker, retrying until the first successful delivery. Runtime options can
    disable the reporting.
  • Workers now log a [TMPRL1104] warning when a workflow task takes longer than 5 seconds. Set
    TEMPORAL_WORKFLOW_TASK_DURATION_WARN_SECONDS to change the threshold.

Breaking Changes 💥

  • Activity failures now include the latest heartbeat details atomically instead of force-flushing a
    throttled heartbeat first. Temporal Server 1.16.0 or newer is required to guarantee those details
    are preserved on failure; workers warn when the server does not advertise support.

Fixed

  • Workers no longer send worker heartbeats or appear in centralized heartbeat reports before they
    begin polling.
  • Ephemeral server processes no longer leak on failed start.
  • Local activity resolutions are now delivered to workflows as each activity completes instead of
    waiting for every local activity in the workflow task. This allows sequences of short local
    activities to make progress while a long-running local activity executes in parallel, while
    preserving the resolution ordering recorded in existing histories during replay.
  • Try-cancel child workflows no longer cause nondeterminism when they complete or fail after their
    cancellation was requested.
  • Nexus tasks are now timed out locally even when the server sends a request-timeout header that
    falls outside the Nexus duration grammar, such as a negative value for a task whose deadline has
    already elapsed, a sub-millisecond unit, or a multi-unit value like 1m30s. Previously such a
    header was ignored entirely, so the handler was never told the task had timed out, and a task
    left unanswered could block worker shutdown indefinitely.

What's Changed

New Contributors

Full Changelog: 1.31.0...1.32.0

Don't miss a new sdk-python release

NewReleases is sending notifications on new releases.