module documentation

Undocumented

Function setup_deterministic_runtime Installs Temporal's deterministic time, id, and random providers for ADK.
Class _AdkPayloadConverter PayloadConverter for Google ADK that strips unset None fields.
Function _deterministic_id_provider Undocumented
Function _deterministic_random_provider Undocumented
Function _deterministic_time_provider Undocumented
Function _install_provider Makes provider an ADK platform seam's default, everywhere.
Function _stacklevel_outside_temporalio Undocumented
Function _uuid4_from Undocumented
Function _warn_if_global_otel_providers_not_replay_safe Undocumented
Function _workflow_adk_random Undocumented
Variable _adk_randoms Undocumented
Variable _adk_randoms_lock Undocumented
Variable _install_provider_lock Undocumented
def setup_deterministic_runtime(): (source)

Installs Temporal's deterministic time, id, and random providers for ADK.

Warning

This function is experimental and may change in future versions. Use with caution in production environments.

The providers become the process-wide defaults of ADK's google.adk.platform time, uuid, and random seams, so they apply inside workflow tasks (which run on worker threads with an empty contextvars context) as well as in the calling context. Inside a workflow, time comes from workflow.time(), and ids and randoms come from a workflow-private deterministic stream (a workflow.new_random() per run; ids are v4 UUIDs built from that stream), so ADK-generated ids and retry jitter are reproducible on replay without shifting the sequence user code sees from workflow.random() and workflow.uuid4(). In read-only contexts (query handlers, update validators) time is still workflow.time(), while ids and randoms come from fresh entropy that leaves the private stream untouched, since read-only results are never replayed. Outside a workflow in the same process (activities, client code) they fall back to time.time(), uuid.uuid4(), and an unseeded random.Random().

Overrides through ADK's set_*_provider functions must be made after this runs (after the worker starts, or from workflow code); one made earlier is replaced, with a warning. ADK's reset_*_provider functions restore these deterministic providers, not the standard-library ones.

GoogleAdkPlugin calls this when a worker or replayer starts. Calling it again is a no-op.

def _deterministic_id_provider() -> str: (source)

Undocumented

def _deterministic_random_provider() -> random.Random: (source)

Undocumented

def _deterministic_time_provider() -> float: (source)

Undocumented

def _install_provider(module: Any, var_name: str, default_name: str, provider: Callable[[], Any]): (source)

Makes provider an ADK platform seam's default, everywhere.

ADK's set_*_provider functions set a value in the calling context only. Workflow tasks run on worker threads, which start with an empty contextvars context, so a value set from the worker's event loop never reaches them and ADK falls back to its wall-clock and random defaults there. A ContextVar's default, unlike a set value, is visible from every context, so the module's variable is replaced with one that defaults to provider. The module's _default_* binding is rebound too, because reset_*_provider restores that binding: without this, an override followed by a reset would land on the standard-library provider rather than back on provider. ADK's set_*_provider and reset_*_provider operate on the new variable from then on; a value set on the old one beforehand is orphaned, so it is warned about. A no-op when provider is already installed.

def _stacklevel_outside_temporalio() -> int: (source)

Undocumented

def _uuid4_from(rng: random.Random) -> uuid.UUID: (source)

Undocumented

def _warn_if_global_otel_providers_not_replay_safe(): (source)

Undocumented

def _workflow_adk_random() -> random.Random: (source)

Undocumented

_adk_randoms_lock = (source)

Undocumented

_install_provider_lock = (source)

Undocumented