Skip to content

feat(cli): load ~/.deepagents/.env as global dotenv#1909

Draft
Mason Daugherty (mdrxy) wants to merge 1 commit intomainfrom
mdrxy/env
Draft

feat(cli): load ~/.deepagents/.env as global dotenv#1909
Mason Daugherty (mdrxy) wants to merge 1 commit intomainfrom
mdrxy/env

Conversation

@mdrxy
Copy link
Member

Closes #1744


Load ~/.deepagents/.env as a global API key source so users don't have to copy .env files into every project or export secrets in their shell profile. The global file is loaded first with override=False, then the project/CWD .env with the caller's override setting — so project-level values win during /reload while global defaults apply at bootstrap.

Changes

  • Add _GLOBAL_DOTENV_PATH (~/.deepagents/.env) and load it in _load_dotenv before the project .env, using override=False so it acts as a fallback layer
  • OSError reading the global file (permissions, broken symlink) logs a warning with exc_info and falls through to project .env — matches the existing pattern in _find_dotenv_from_start_path
  • Both the module-level bootstrap call and Settings.reload_from_environment go through the same two-tier _load_dotenv, so the behavior is consistent across startup and /reload

@github-actions github-actions bot added cli Related to `deepagents-cli` feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization size: S 50-199 LOC labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to `deepagents-cli` feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization size: S 50-199 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support ~/.deepagents/.env for global API key overrides

1 participant