Global settings and environment detection for deepagents-cli.
This class is initialized once at startup and provides access to:
Settings(
self,
openai_api_key: str | None,
anthropic_api_key: str | None,
google_api_key: str | None,
nvidia_api_key: str | None,
tavily_api_key: str | None,
google_cloud_project: str | None,
deepagents_langchain_project: str | None,
user_langchain_project: str | None,
model_name: str | None = None,
model_provider: str | None = None,
model_context_limit: int | None = None,
model_unsupported_modalities: frozenset[str] = frozenset(),
project_root: Path | None = None,
shell_allow_list: list[str] | None = None,
extra_skills_dirs: list[Path] | None = None
)| Name | Type |
|---|---|
| openai_api_key | str | None |
| anthropic_api_key | str | None |
| google_api_key | str | None |
| nvidia_api_key | str | None |
| tavily_api_key | str | None |
| google_cloud_project | str | None |
| deepagents_langchain_project | str | None |
| user_langchain_project | str | None |
| model_name | str | None |
| model_provider | str | None |
| model_context_limit | int | None |
| model_unsupported_modalities | frozenset[str] |
| project_root | Path | None |
| shell_allow_list | list[str] | None |
| extra_skills_dirs | list[Path] | None |
OpenAI API key if available.
Anthropic API key if available.
Google API key if available.
NVIDIA API key if available.
Tavily API key if available.
Google Cloud project ID for VertexAI authentication.
LangSmith project name for deepagents agent tracing.
Original LANGSMITH_PROJECT from environment (for user code).
Currently active model name, set after model creation.
Provider identifier (e.g., openai, anthropic, google_genai).
Maximum input token count from the model profile.
Input modalities not indicated as supported by the model profile.
Current project root directory, or None if not in a git project.
Shell commands that don't require user approval.
Extra directories added to the skill path containment allowlist.
These do NOT add new skill discovery locations — skills are still only
discovered from the standard directories. They exist so that symlinks inside
standard skill directories can point to targets in these additional
locations without being rejected by the containment check
in load_skill_content.
Set via DEEPAGENTS_CLI_EXTRA_SKILLS_DIRS env var (colon-separated) or
[skills].extra_allowed_dirs in ~/.deepagents/config.toml.
Check if OpenAI API key is configured.
Check if Anthropic API key is configured.
Check if Google API key is configured.
Check if NVIDIA API key is configured.
Check if VertexAI is available (Google Cloud project set, no API key).
VertexAI uses Application Default Credentials (ADC) for authentication, so if GOOGLE_CLOUD_PROJECT is set and GOOGLE_API_KEY is not, we assume VertexAI.
Check if Tavily API key is configured.
Get the base user-level .deepagents directory.
Get the base user-level .agents directory (~/.agents).
Create settings by detecting the current environment.
Reload selected settings from environment variables and project files.
This refreshes only fields that are expected to change at runtime (API keys, Google Cloud project, project root, shell allow-list, and LangSmith tracing project).
Runtime model state (model_name, model_provider,
model_context_limit) and the original user LangSmith project
(user_langchain_project) are intentionally preserved -- they are
not in reloadable_fields and are never touched by this method.
.env files are loaded with override=False, so shell-exported
variables always take precedence. To override a shell-exported key
from .env, use the DEEPAGENTS_CLI_ prefix (e.g.
DEEPAGENTS_CLI_OPENAI_API_KEY).
Get user-level AGENTS.md path for a specific agent.
Returns path regardless of whether the file exists.
Get project-level AGENTS.md paths.
Checks both {project_root}/.deepagents/AGENTS.md and
{project_root}/AGENTS.md, returning all that exist. If both are
present, both are loaded and their instructions are combined, with
.deepagents/AGENTS.md first.
Get the global agent directory path.
Ensure the global agent directory exists and return its path.
Get user-level skills directory path for a specific agent.
Ensure user-level skills directory exists and return its path.
Get project-level skills directory path.
Ensure project-level skills directory exists and return its path.
Get user-level agents directory path for custom subagent definitions.
Get project-level agents directory path for custom subagent definitions.
Get user-level ~/.agents/skills/ directory.
This is a generic alias path for skills that is tool-agnostic.
Get project-level .agents/skills/ directory.
This is a generic alias path for skills that is tool-agnostic.
Get user-level ~/.claude/skills/ directory (experimental).
Convenience bridge for cross-tool skill sharing with Claude Code. This is experimental and may be removed.
Get project-level .claude/skills/ directory (experimental).
Convenience bridge for cross-tool skill sharing with Claude Code. This is experimental and may be removed.
Get the directory containing built-in skills that ship with the CLI.
Get user-configured extra skill directories.
Set via DEEPAGENTS_CLI_EXTRA_SKILLS_DIRS (colon-separated paths) or
[skills].extra_allowed_dirs in ~/.deepagents/config.toml.