class _ReplaySafeRunTree(RunTree): (source)
Known subclasses: temporalio.contrib.langsmith._interceptor._RootReplaySafeRunTreeFactory
Constructor: _ReplaySafeRunTree(run_tree, executor)
Wrapper around a RunTree with replay-safe post, end, and patch.
Inherits from RunTree so isinstance checks pass, but does not call super().__init__()—the wrapped _run is the real RunTree. Attribute access is delegated via __getattr__/__setattr__.
During replay, post(), end(), and patch() become no-ops (I/O suppression), but create_child() still runs to maintain parent-child linkage so @traceable's _setup_run can build the run tree across the replay boundary. In workflow context, post() and patch() submit to a single-worker ThreadPoolExecutor for FIFO ordering, avoiding blocking on the workflow task thread.
| Method | __getattr__ |
Delegate attribute access to the wrapped RunTree. |
| Method | __init__ |
Wrap an existing RunTree with replay-safe overrides. |
| Method | __setattr__ |
Delegate attribute setting to the wrapped RunTree. |
| Method | create |
Create a child run, returning another _ReplaySafeRunTree. |
| Method | end |
End the run, skipping during replay. |
| Method | patch |
Patch the run to LangSmith, skipping during replay. |
| Method | post |
Post the run to LangSmith, skipping during replay. |
| Method | to |
Delegate to the wrapped RunTree's to_headers. |
| Method | _inject |
Inject deterministic run_id and start_time in workflow context. |
| Method | _submit |
Submit work to the background executor. |
Create a child run, returning another _ReplaySafeRunTree.
In workflow context, injects deterministic run_id and start_time unless they are passed in manually via kwargs.
End the run, skipping during replay.
Pre-computes end_time via workflow.now() in workflow context so RunTree.end() doesn't call datetime.now() (non-deterministic and sandbox-restricted).