Undocumented
| Function | setup |
Installs Temporal's deterministic time, id, and random providers for ADK. |
| Class | _ |
PayloadConverter for Google ADK that strips unset None fields. |
| Function | _deterministic |
Undocumented |
| Function | _deterministic |
Undocumented |
| Function | _deterministic |
Undocumented |
| Function | _install |
Makes provider an ADK platform seam's default, everywhere. |
| Function | _stacklevel |
Undocumented |
| Function | _uuid4 |
Undocumented |
| Function | _warn |
Undocumented |
| Function | _workflow |
Undocumented |
| Variable | _adk |
Undocumented |
| Variable | _adk |
Undocumented |
| Variable | _install |
Undocumented |
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.
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.