Skip to content

Commit 15afbcd

Browse files
speedstorm1copybara-github
authored andcommitted
feat: Add ADK_DISABLE_LOAD_DOTENV environment variable that disables automatic loading of .env when running ADK cli, if set to true or 1
Fixes #3228 PiperOrigin-RevId: 825273905
1 parent ee8acc5 commit 15afbcd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/google/adk/cli/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from ..sessions.in_memory_session_service import InMemorySessionService
3535
from ..sessions.session import Session
3636
from ..utils.context_utils import Aclosing
37+
from ..utils.env_utils import is_env_enabled
3738
from .utils import envs
3839
from .utils.agent_loader import AgentLoader
3940

@@ -160,7 +161,8 @@ async def run_cli(
160161
root_agent = AgentLoader(agents_dir=agent_parent_dir).load_agent(
161162
agent_folder_name
162163
)
163-
envs.load_dotenv_for_agent(agent_folder_name, agent_parent_dir)
164+
if not is_env_enabled('ADK_DISABLE_LOAD_DOTENV'):
165+
envs.load_dotenv_for_agent(agent_folder_name, agent_parent_dir)
164166
if input_file:
165167
session = await run_input_file(
166168
app_name=agent_folder_name,

0 commit comments

Comments
 (0)