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.

AutoGPT: Fix plugin commands accumulating

Reinier van der Leer563df6ca3a4b
diff --git a/autogpts/autogpt/autogpt/agents/base.py b/autogpts/autogpt/autogpt/agents/base.py
index 5f900f427c..c951f20ae6 100644
--- a/autogpts/autogpt/autogpt/agents/base.py
+++ b/autogpts/autogpt/autogpt/agents/base.py
@@ -244,8 +244,8 @@ class BaseAgent(Configurable[BaseAgentSettings], ABC):
def build_prompt(
self,
scratchpad: PromptScratchpad,
- extra_commands: list[CompletionModelFunction] = [],
- extra_messages: list[ChatMessage] = [],
+ extra_commands: Optional[list[CompletionModelFunction]] = None,
+ extra_messages: Optional[list[ChatMessage]] = None,
**extras,
) -> ChatPrompt:
"""Constructs and returns a prompt with the following structure:
@@ -256,6 +256,10 @@ class BaseAgent(Configurable[BaseAgentSettings], ABC):
Params:
cycle_instruction: The final instruction for a thinking cycle
"""
+ if extra_commands is None:
+ extra_commands = []
+ if extra_messages is None:
+ extra_messages = []
# Apply additions from plugins
for plugin in self.config.plugins: