Skip to content
This repository was archived by the owner on Nov 11, 2026. It is now read-only.

Commit 1f72f18

Browse files
feat(integrations): add Google ADK Live voice tracing integration (#3115)
## Google ADK Live voice tracing Adds `langsmith.integrations.google_adk_live`: `LangSmithLivePlugin`, an ADK `BasePlugin` that traces `Runner.run_live` (Gemini Live) using the `EventSession` engine from #3114. `run_live` is not covered by ADK's standard OpenTelemetry instrumentation, so this plugin is what produces a trace for a Live voice conversation. Kept in its own `google-adk-live` extra, separate from the existing batch `google-adk` integration, so non-streaming ADK users take on no new dependencies. Install: `pip install "langsmith[google-adk-live]"`. Builds on #3114. Authored with the help of an AI agent. #### PR Dependency Tree * **PR #3112** * **PR #3113** * **PR #3114** * **PR #3115** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) #### PR Dependency Tree * **PR #3115** 👈 * **PR #3144** * **PR #3145** * **PR #3146** This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) --------- Co-authored-by: open-swe[bot] <[email protected]>
1 parent 93361c0 commit 1f72f18

6 files changed

Lines changed: 1314 additions & 758 deletions

File tree

‎python/langsmith/_internal/voice/session.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,25 @@ def close_span(
355355
*,
356356
outputs: dict[str, Any] | None = None,
357357
usage_metadata: dict[str, Any] | None = None,
358+
metadata: dict[str, Any] | None = None,
358359
) -> None:
359360
"""End and patch a span previously opened with ``open_span``.
360361
361362
Any error already set on ``run`` (``run.error``) is preserved. Outputs
362-
pass through ``scrub`` like every other span payload.
363+
pass through ``scrub`` like every other span payload. ``metadata`` is
364+
merged into the run's existing metadata at close — for detail only known
365+
when the span ends (e.g. the raw wire payload of the event that closed
366+
it), so an ``open_span`` span can preserve it the way ``event_span``
367+
does. It passes through ``scrub`` like any other payload.
363368
"""
364369
if usage_metadata is not None:
365370
run.set(usage_metadata=cast("Any", usage_metadata))
371+
if metadata:
372+
extra = run.extra or {}
373+
merged = dict(extra.get("metadata") or {})
374+
merged.update(scrub(metadata))
375+
extra["metadata"] = merged
376+
run.extra = extra
366377
run.end(outputs=scrub(outputs) if outputs is not None else {})
367378
run.patch()
368379

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""LangSmith integration for Google ADK Live (Gemini Live voice).
2+
3+
Provides :class:`LangSmithGoogleADKLivePlugin`, an ADK ``BasePlugin`` that traces
4+
``Runner.run_live`` voice conversations. Kept in its own package (and behind the
5+
``google-adk-live`` extra) so that users of the non-streaming
6+
``langsmith.integrations.google_adk`` integration do not take on its
7+
dependencies.
8+
9+
The class is imported lazily so this package can be imported without
10+
``google-adk`` installed.
11+
"""
12+
13+
from __future__ import annotations
14+
15+
from typing import TYPE_CHECKING, Any
16+
17+
if TYPE_CHECKING:
18+
from langsmith.integrations.google_adk_live._plugin import (
19+
LangSmithGoogleADKLivePlugin,
20+
)
21+
22+
__all__ = ["LangSmithGoogleADKLivePlugin"]
23+
24+
25+
def __getattr__(name: str) -> Any:
26+
if name == "LangSmithGoogleADKLivePlugin":
27+
from langsmith.integrations.google_adk_live._plugin import (
28+
LangSmithGoogleADKLivePlugin,
29+
)
30+
31+
return LangSmithGoogleADKLivePlugin
32+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 commit comments

Comments
 (0)