Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(agent): Fix type issues with agent ID and apply_overrides_to_ai_settings

Reinier van der Leer2d4e16d5e1ba
diff --git a/autogpts/autogpt/autogpt/agent_manager/agent_manager.py b/autogpts/autogpt/autogpt/agent_manager/agent_manager.py
index dc3bc64618..0b4731bc6a 100644
--- a/autogpts/autogpt/autogpt/agent_manager/agent_manager.py
+++ b/autogpts/autogpt/autogpt/agent_manager/agent_manager.py
@@ -29,6 +29,7 @@ class AgentManager:
]
def get_agent_dir(self, agent_id: str, must_exist: bool = False) -> Path:
+ assert len(agent_id) > 0
agent_dir = self.agents_dir / agent_id
if must_exist and not agent_dir.exists():
raise FileNotFoundError(f"No agent with ID '{agent_id}'")
diff --git a/autogpts/autogpt/autogpt/agents/base.py b/autogpts/autogpt/autogpt/agents/base.py
index 062149edd7..7c34d40ad8 100644
--- a/autogpts/autogpt/autogpt/agents/base.py
+++ b/autogpts/autogpt/autogpt/agents/base.py
@@ -124,7 +124,7 @@ class BaseAgentConfiguration(SystemConfiguration):
class BaseAgentSettings(SystemSettings):
- agent_id: Optional[str] = None
+ agent_id: str = ""
agent_data_dir: Optional[Path] = None
ai_profile: AIProfile = Field(default_factory=lambda: AIProfile(ai_name="AutoGPT"))
diff --git a/autogpts/autogpt/autogpt/app/setup.py b/autogpts/autogpt/autogpt/app/setup.py
index ab41afa3c2..8a271d26f4 100644
--- a/autogpts/autogpt/autogpt/app/setup.py
+++ b/autogpts/autogpt/autogpt/app/setup.py
@@ -12,8 +12,8 @@ logger = logging.getLogger(__name__)
def apply_overrides_to_ai_settings(
ai_profile: AIProfile,
directives: AIDirectives,
- override_name: str = "",
- override_role: str = "",
+ override_name: Optional[str] = "",
+ override_role: Optional[str] = "",
replace_directives: bool = False,
resources: Optional[list[str]] = None,
constraints: Optional[list[str]] = None,