Opens a Datadog/OTel child span (always, unless component:ai is disabled) and, when
LangSmith tracing is enabled, an intermediate LangSmith CHILD span that nests under the
active root (opened by withRootTrace). Reuses the process-wide getLangSmithClient() so
every LangSmith span lands in one trace tree and shares a single batch queue. Unlike
withRootTrace, it does NOT flush — the enclosing root owns the flush.
This is the call-site escape hatch: prefer defineStep, which wraps a function at its
definition so the callable keeps its name and there's no traced twin. Reach for withStepTrace
only for inline regions or third-party functions you can't wrap at the definition.
Opens a Datadog/OTel child span (always, unless
component:aiis disabled) and, when LangSmith tracing is enabled, an intermediate LangSmith CHILD span that nests under the active root (opened bywithRootTrace). Reuses the process-widegetLangSmithClient()so every LangSmith span lands in one trace tree and shares a single batch queue. UnlikewithRootTrace, it does NOT flush — the enclosing root owns the flush.This is the call-site escape hatch: prefer
defineStep, which wraps a function at its definition so the callable keeps its name and there's no traced twin. Reach forwithStepTraceonly for inline regions or third-party functions you can't wrap at the definition.