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): Omit `EventHistory` progress message if empty

Reinier van der Leerbdda3a6698cc
diff --git a/autogpts/autogpt/autogpt/components/event_history.py b/autogpts/autogpt/autogpt/components/event_history.py
index 5de1926f45..a66b18e2d9 100644
--- a/autogpts/autogpt/autogpt/components/event_history.py
+++ b/autogpts/autogpt/autogpt/components/event_history.py
@@ -34,13 +34,12 @@ class EventHistoryComponent(MessageProvider, AfterParse, AfterExecute):
self.llm_provider = llm_provider
def get_messages(self) -> Iterator[ChatMessage]:
- yield ChatMessage.system(
- self._compile_progress(
- self.event_history.episodes,
- self.max_tokens,
- self.count_tokens,
- )
- )
+ if progress := self._compile_progress(
+ self.event_history.episodes,
+ self.max_tokens,
+ self.count_tokens,
+ ):
+ yield ChatMessage.system(f"## Progress on your Task so far\n\n{progress}")
def after_parse(self, result: ThoughtProcessOutput) -> None:
if result.command_name: