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,
project_root: Path | None = None,
shell_allow_list: list[str] | 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 |
| project_root | Path | None |
| shell_allow_list | list[str] | None |
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.
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 the directory containing built-in skills that ship with the CLI.