fix(translator): honor APIKeyPassthrough for Gemini provider#2042
fix(translator): honor APIKeyPassthrough for Gemini provider#2042mesutoezdil wants to merge 18 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the Gemini model translation path so it correctly supports APIKeyPassthrough, aligning Gemini with the behavior already implemented for other providers in the ADK agent translator.
Changes:
- Avoid injecting the Google API key env var/secret ref when
APIKeyPassthroughis enabled (and only mount the secret when passthrough is off and a secret is configured). - Ensure the translated
adk.Geminimodel config reflectsapi_key_passthrough.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
adb6fd6 to
ce7e91f
Compare
EItanya
left a comment
There was a problem hiding this comment.
Makes sense, is passthrough implemented for Gemini in our adk + adk go?
hm not fully. the python adk has the api_key_passthrough field on kagentgeminillm but is missing set_passthrough_key(), so llmassthroughplugin skips gemini at runtime. go adk has no gemini model implementation at all. my pr fixes the translator side only. |
If this doesn't fully work then can we add those fixes? |
4781a44 to
4a2fc83
Compare
done |
How can this be true, seems like a bigger issue than passthrough in python |
correction: Go ADK does have Gemini (agent.go:215). What's missing is passthrough support there. it always requires env vars regardless of ApiKeyPassthrough. This PR covers translator + Python ADK; Go ADK passthrough is a separate follow-up. |
59391cd to
dc85583
Compare
819aea7 to
7beddf6
Compare
7beddf6 to
bbade9d
Compare
- skip Google API key secret mount when passthrough is enabled - set api_key_passthrough on adk.Gemini model struct - implement set_passthrough_key on KAgentGeminiLlm so LLMPassthroughPlugin works at runtime Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
bbade9d to
3e3e145
Compare
cr.kagent.dev was removed in kagent-dev#2177, and the app image tag changed to app:dev. The golden file still had both old values, which caused go-unit-tests to fail on PR kagent-dev#2042. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
3e3e145 to
240dc7d
Compare
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
e7cb874 to
a8a0c9a
Compare
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…ssthrough Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
The Gemini provider in the model translator was not checking
APIKeyPassthrough. It always tried to mount the Google API key secret, even when passthrough mode was enabled. It also never setAPIKeyPassthroughon the ADK model struct. All other providers (OpenAI, Anthropic, AzureOpenAI, Ollama) already handle this correctly.The CRD validation also rejected
apiKeyPassthrough: truefor Gemini, so the flag could never be enabled at all. Gemini uses plain API key auth like OpenAI and Anthropic, so passthrough is valid for it. The rule now only blocks the Vertex providers, which authenticate with service accounts. CRD manifests regenerated.On the runtime side,
KAgentGeminiLlmnow accepts the Bearer token from the incoming request viaset_passthrough_keyand uses it as the Gemini API key, falling back toGOOGLE_API_KEYorGEMINI_API_KEYenv vars as before. Setting a new token invalidates the cached API clients. Covered by new unit tests.