-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(config): implement comprehensive A0_ environment variable support #691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Enable full configuration of Agent Zero through Docker environment variables, addressing the need for simplified deployments and automation. This change allows all critical settings to be configured via environment variables prefixed with A0_, including: - Core model configuration (chat, utility, embedding, browser) - Memory system parameters - Authentication and security settings - API keys management - Agent profiles and behavior - Remote function call configuration - Speech processing options - MCP server settings This implementation fulfills the requirement for easier Docker-based deployments and configuration management as requested in the ticket. All settings previously only available through the UI or settings.json can now be configured via environment variables, making containerized deployments more consistent and automation-friendly. BREAKING CHANGE: Some environment variable names have been standardized to the A0_ prefix convention. Existing deployments using non-prefixed variables will need to update their configuration.
…ironment variable handling - Restructured settings.py for better readability and maintainability - Added dedicated _get_envvar_settings function for environment variable processing - Renamed authentication environment variables from A0_AUTH_* to A0_SET_AUTH_* for consistency - Added debug print statements for troubleshooting settings loading - Normalized default settings to use hardcoded values instead of env var fallbacks BREAKING CHANGE: Authentication environment variables have been renamed from A0_AUTH_LOGIN and A0_AUTH_PASSWORD to A0_SET_AUTH_LOGIN and A0_SET_AUTH_PASSWORD respectively. Update your environment configuration accordingly.
refactor(settings): Reorganize settings loading logic and improve environment variable handlingSummaryThis PR refactors the settings system to improve maintainability and consistency in environment variable handling. The changes focus on restructuring the settings loading logic, introducing dedicated functions for environment variable processing, and standardizing naming conventions. Key ChangesSettings System Restructuring
Environment Variable Improvements
Breaking Changes
Impact
This refactor addresses technical debt in the settings system while maintaining all existing functionality. The changes are primarily structural and should not affect normal operation once environment variables are updated to the new naming convention. |
Might be handy to include the ability to set the external api key as well, since its currently auto generated based on the login/password. This would make it much easier to set up headless. |
copy[key] = value # make default instead | ||
|
||
# mcp server token is set automatically | ||
copy["mcp_server_token"] = create_auth_token() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like so:
# mcp server token is set automatically (use custom external API key if provided)
custom_external_key = dotenv.get_dotenv_value("A0_EXTERNAL_API_KEY")
if custom_external_key:
copy["mcp_server_token"] = custom_external_key
else:
copy["mcp_server_token"] = create_auth_token()
feat(config): Implement Comprehensive A0_ Environment Variable Support
Summary
This PR implements full configuration of Agent Zero through Docker environment variables, addressing the need for simplified deployments and automation. All critical settings can now be configured via environment variables prefixed with
A0_
, making containerized deployments more consistent and automation-friendly. #686Test Container: wojons/agent-zero:v0.9.4-load-from-env
Changes Implemented
Environment Variables Now Supported
Core Model Configuration
A0_CHAT_MODEL_PROVIDER
,A0_CHAT_MODEL_NAME
,A0_CHAT_MODEL_API_BASE
A0_CHAT_MODEL_CTX_LENGTH
,A0_CHAT_MODEL_CTX_HISTORY
,A0_CHAT_MODEL_VISION
A0_CHAT_MODEL_RL_REQUESTS
,A0_CHAT_MODEL_RL_INPUT
,A0_CHAT_MODEL_RL_OUTPUT
Utility Model Configuration
A0_UTIL_MODEL_PROVIDER
,A0_UTIL_MODEL_NAME
,A0_UTIL_MODEL_API_BASE
A0_UTIL_MODEL_CTX_LENGTH
,A0_UTIL_MODEL_CTX_INPUT
A0_UTIL_MODEL_RL_REQUESTS
,A0_UTIL_MODEL_RL_INPUT
,A0_UTIL_MODEL_RL_OUTPUT
Embedding Model Configuration
A0_EMBED_MODEL_PROVIDER
,A0_EMBED_MODEL_NAME
,A0_EMBED_MODEL_API_BASE
A0_EMBED_MODEL_RL_REQUESTS
,A0_EMBED_MODEL_RL_INPUT
Browser Model Configuration
A0_BROWSER_MODEL_PROVIDER
,A0_BROWSER_MODEL_NAME
,A0_BROWSER_MODEL_API_BASE
A0_BROWSER_MODEL_VISION
,A0_BROWSER_MODEL_RL_REQUESTS
,A0_BROWSER_MODEL_RL_INPUT
,A0_BROWSER_MODEL_RL_OUTPUT
Memory System Configuration
A0_MEMORY_RECALL_ENABLED
,A0_MEMORY_RECALL_DELAYED
,A0_MEMORY_RECALL_INTERVAL
A0_MEMORY_RECALL_HISTORY_LEN
,A0_MEMORY_RECALL_MEMORIES_MAX_SEARCH
,A0_MEMORY_RECALL_SOLUTIONS_MAX_SEARCH
A0_MEMORY_RECALL_MEMORIES_MAX_RESULT
,A0_MEMORY_RECALL_SOLUTIONS_MAX_RESULT
A0_MEMORY_RECALL_SIMILARITY_THRESHOLD
,A0_MEMORY_RECALL_QUERY_PREP
,A0_MEMORY_RECALL_POST_FILTER
A0_MEMORY_MEMORIZE_ENABLED
,A0_MEMORY_MEMORIZE_CONSOLIDATION
,A0_MEMORY_MEMORIZE_REPLACE_THRESHOLD
Authentication & Security
A0_AUTH_LOGIN
,A0_AUTH_PASSWORD
,A0_ROOT_PASSWORD
,A0_RFC_PASSWORD
API Keys
A0_API_KEY_ANTHROPIC
,A0_API_KEY_DEEPSEEK
,A0_API_KEY_GOOGLE
,A0_API_KEY_GROQ
A0_API_KEY_HUGGINGFACE
,A0_API_KEY_LM_STUDIO
,A0_API_KEY_MISTRAL
,A0_API_KEY_OLLAMA
A0_API_KEY_OPENAI
,A0_API_KEY_AZURE
,A0_API_KEY_OPENROUTER
,A0_API_KEY_SAMBANOVA
,A0_API_KEY_VENICE
,A0_API_KEY_OTHER
Agent Configuration
A0_AGENT_PROFILE
,A0_AGENT_MEMORY_SUBDIR
,A0_AGENT_KNOWLEDGE_SUBDIR
Remote Function Calls
A0_RFC_AUTO_DOCKER
,A0_RFC_URL
,A0_RFC_PORT_HTTP
,A0_RFC_PORT_SSH
Speech Configuration
A0_STT_MODEL_SIZE
,A0_STT_LANGUAGE
,A0_STT_SILENCE_THRESHOLD
,A0_STT_SILENCE_DURATION
,A0_STT_WAITING_TIMEOUT
A0_TTS_KOKORO
MCP Configuration
A0_MCP_SERVERS
,A0_MCP_CLIENT_INIT_TIMEOUT
,A0_MCP_CLIENT_TOOL_TIMEOUT
A0_MCP_SERVER_ENABLED
,A0_A2A_SERVER_ENABLED
Breaking Changes
A0_
prefix conventionA0_MCP_SERVERS
environment variable now expects a JSON string formatNotes
A0_ROOT_PASSWORD
- was not able to figure out how to get this one to work assume i am missing something simple.A0_RFC_PASSWORD
- was not able to test thisA0_MCP_SERVERS
- tested and working but might need to check for invaild json and set to blank but waiting feedback