Pass the value of GOOGLE_CLOUD_LOCATION and GOOGLE_GENAI_USE_VERTEXAI while creating the object of Ruuner
Problem description I have created an application which will be used by multiple clients. The of GOOGLE_CLOUD_LOCATION is defined as environment variable. So, the same location will be used for each client. I need to use different location for each client as per their compliance requirements. How can I change the location at runtime?
Same is the case for GOOGLE_GENAI_USE_VERTEXAI. I am using gemini api key for some clients, so I need to change the value of GOOGLE_GENAI_USE_VERTEXAI as well at runtime.
Desired solution Provide a way to pass the value for GOOGLE_GENAI_USE_VERTEXAI and GOOGLE_CLOUD_LOCATION while creating the object of google.adk.runners.Runner
Additional context I am using google-adk==1.2.1
@hangfei, please can you assign this one to me? I want to take it on.
Hi @bl3ck,
Please share the possible solution and tentative timeline.
@naitik-parekh Thanks for getting back to me on this. Here's how I would like to go about it:
I'll extend the Runner class constructor to accept optional parameters that override environment variables for specific instances.
Proposed Solution
Add optional cloud_location and use_vertex_ai parameters to the Runner constructor with configuration precedence: constructor params → environment variables → defaults.
runner = Runner(
agent=my_agent,
app_name="client_app",
session_service=session_service,
cloud_location="europe-west1", # Overrides GOOGLE_CLOUD_LOCATION
use_vertex_ai=True # Overrides GOOGLE_GENAI_USE_VERTEXAI
)
I'll also validate the cloud_location parameter against supported Google Cloud regions to ensure compliance requirements are met.
Timeline:
- Week 1: Core implementation and unit tests
- Week 2: Integration testing, documentation, and PR refinement
Are there other ADK components beyond Runner that consume these environment variables directly?
Hi @bl3ck ,
I have not used all the classes/methods of ADK to be able to comment where else these variables are used.
Hi @naitik-parekh and thanks to everyone who participated in this thread.
We're currently doing some housekeeping on our issue tracker. Given the rapid pace of development and the number of updates since this was last active, there's a good chance this issue has been resolved in a newer version. To help us keep our backlog focused on current issues, we are closing this as stale.
If you're still facing this problem, could you please update to the very latest version of the library and confirm the issue still exists? If it does, please comment here, and we will be happy to reopen this issue and investigate further.
Thanks for your contribution and understanding!