fix(integrations/google_adk): allow offline tracing without CONFIDENT_API_KEY (#3005) - #3007
Open
Anai-Guo wants to merge 2 commits into
Open
fix(integrations/google_adk): allow offline tracing without CONFIDENT_API_KEY (#3005)#3007Anai-Guo wants to merge 2 commits into
Anai-Guo wants to merge 2 commits into
Conversation
…_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.
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
instrument_google_adk()raisedValueError: CONFIDENT_API_KEY is not setwhen 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 acceptsapi_key=Noneand captures spans locally. Its sibling helpers —instrument_openinference,instrument_agentcore,instrument_strands— all fall back toget_confident_api_key()without hard-gating on the result. Onlygoogle_adkadded an extraraise, 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 theValueError; with this change the key gate is passed and the call delegatesinstrument_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 nogoogle-adk/network):test_instrument_google_adk_runs_without_confident_api_key— no key → noValueError, forwardsapi_key=None. Fails onmain, passes with this change.test_instrument_google_adk_forwards_explicit_key— an explicit key is still forwarded unchanged.black --checkclean on both files.Fixes #3005
🤖 Generated with Claude Code