Skip to content

fix(integrations/google_adk): allow offline tracing without CONFIDENT_API_KEY (#3005) - #3007

Open
Anai-Guo wants to merge 2 commits into
confident-ai:mainfrom
Anai-Guo:fix/google-adk-offline-key
Open

fix(integrations/google_adk): allow offline tracing without CONFIDENT_API_KEY (#3005)#3007
Anai-Guo wants to merge 2 commits into
confident-ai:mainfrom
Anai-Guo:fix/google-adk-offline-key

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

instrument_google_adk() raised ValueError: CONFIDENT_API_KEY is not set when no Confident key was configured, even though the LLM tracing docs state that spans, span types, metadata and token costs run entirely locally, with an account only required to stream/visualize traces on the cloud (reported in #3005).

The function ultimately delegates to instrument_openinference(), which already accepts api_key=None and captures spans locally. Its sibling helpers — instrument_openinference, instrument_agentcore, instrument_strands — all fall back to get_confident_api_key() without hard-gating on the result. Only google_adk added an extra raise, so the missing key blocked local-only use before any instrumentation started.

Change

Drop the extra guard so a missing key is forwarded as None (local mode), matching the siblings and the documented offline behavior. Callers who do want cloud upload keep passing/exporting the key exactly as before.

         if not api_key:
             api_key = get_confident_api_key()
-            if not api_key:
-                raise ValueError(
-                    "CONFIDENT_API_KEY is not set. "
-                    "Pass it directly or set the environment variable."
-                )

Verification

Reproduced on deepeval==4.1.5: instrument_google_adk() with no key raised the ValueError; with this change the key gate is passed and the call delegates instrument_openinference(api_key=None, integration="Google ADK") for local tracing.

Added tests/test_core/test_google_adk_offline.py (runs in the core PR suite, mocks the heavy instrumentor + delegate so it needs no google-adk/network):

  • test_instrument_google_adk_runs_without_confident_api_key — no key → no ValueError, forwards api_key=None. Fails on main, passes with this change.
  • test_instrument_google_adk_forwards_explicit_key — an explicit key is still forwarded unchanged.

black --check clean on both files.

Fixes #3005

🤖 Generated with Claude Code

…_API_KEY (confident-ai#3005)

instrument_google_adk() delegates to instrument_openinference(), which
accepts api_key=None and captures spans locally. The tracing docs state
that spans, span types, metadata and token costs run entirely locally,
with a Confident account only required to stream/visualize traces in the
cloud. The sibling helpers (instrument_openinference / instrument_agentcore
/ instrument_strands) fall back to get_confident_api_key() without hard-
gating on it, but google_adk raised ValueError when no key was present,
blocking local-only use before any instrumentation started.

Drop the extra guard so a missing key is forwarded as None (local mode),
matching the siblings and the documented offline behavior.
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

@Anai-Guo is attempting to deploy a commit to the Confident AI Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

instrument_google_adk() raises CONFIDENT_API_KEY is not set despite docs stating tracing works fully offline

1 participant