-
Notifications
You must be signed in to change notification settings - Fork 560
Description
Component/Module
Intelligence (Agents/Tools/Prompts)
Feature Type
Enhancement to Existing Feature
Problem Statement
AgentsService.__init__ reads PROJECT_PATH directly via os.getenv(), bypassing the ConfigProvider abstraction used everywhere else in the project. This introduces several issues:
- Inconsistent config access:
PROJECT_PATHis the only environment variable in the module read directly viaos.getenv(), while all others go throughConfigProvider. - No startup validation: The value is not validated when the application starts, meaning misconfiguration is only caught at runtime.
- Invisible to central config management: Because it bypasses
ConfigProvider, the variable is not visible or manageable through the central config layer.
Proposed Solution
- Add a
get_project_path()static method toconfig_provider.pyfollowing the same pattern as existing static methods in that file. - Replace the direct
os.getenvcall inagents_service.pywithConfigProvider.get_project_path().
Current Implementation:
agents_service.pyline 57 reads:os.getenv('PROJECT_PATH', 'projects/')directly.config_provider.pyalready has a consistent pattern for all other env vars using@staticmethodmethods.
After this change:
PROJECT_PATHis read throughConfigProviderlike every other env var.config_provider.pybecomes the single source of truth for all config.
Use Case
Any developer deploying Potpie should have PROJECT_PATH validated and resolved consistently with all other environment variables — through ConfigProvider — so misconfigurations are caught early at startup rather than silently failing later.
Alternatives Considered
Adding inline validation directly in agents_service.py but rejected because it still bypasses ConfigProvider and duplicates logic that already belongs in the config layer.
Additional Context
Benefits:
- Consistent config access across the entire codebase
- Startup validation through the central config layer
- Follows the 12-factor app config principle: https://12factor.net/config
Where to look:
agents_service.py— line 57config_provider.py— see existing@staticmethodmethods for the pattern to follow
Skill level needed: Basic Python. No prior knowledge of this codebase required, the pattern to follow is already there in config_provider.py.
Feel free to comment if you have any questions before you start!