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.

Move misplaced log_cycle statements

Reinier van der Leerddb7efa593db
diff --git a/autogpt/agents/agent.py b/autogpt/agents/agent.py
index 93d3de8657..563c682385 100644
--- a/autogpt/agents/agent.py
+++ b/autogpt/agents/agent.py
@@ -17,6 +17,7 @@ from autogpt.llm.base import Message
from autogpt.llm.utils import count_string_tokens
from autogpt.logs import logger
from autogpt.logs.log_cycle import (
+ CURRENT_CONTEXT_FILE_NAME,
FULL_MESSAGE_HISTORY_FILE_NAME,
NEXT_ACTION_FILE_NAME,
USER_INPUT_FILE_NAME,
@@ -109,6 +110,13 @@ class Agent(BaseAgent):
self.history.raw(),
FULL_MESSAGE_HISTORY_FILE_NAME,
)
+ self.log_cycle_handler.log_cycle(
+ self.ai_config.ai_name,
+ self.created_at,
+ self.cycle_count,
+ prompt.raw(),
+ CURRENT_CONTEXT_FILE_NAME,
+ )
return prompt
def execute(
diff --git a/autogpt/agents/base.py b/autogpt/agents/base.py
index 029b07a05a..e6b24be12b 100644
--- a/autogpt/agents/base.py
+++ b/autogpt/agents/base.py
@@ -11,7 +11,7 @@ if TYPE_CHECKING:
from autogpt.llm.base import ChatModelResponse, ChatSequence, Message
from autogpt.llm.providers.openai import OPEN_AI_CHAT_MODELS, get_openai_command_specs
from autogpt.llm.utils import count_message_tokens, create_chat_completion
-from autogpt.logs import CURRENT_CONTEXT_FILE_NAME, logger
+from autogpt.logs import logger
from autogpt.memory.message_history import MessageHistory
from autogpt.prompts.prompt import DEFAULT_TRIGGERING_PROMPT
@@ -105,13 +105,6 @@ class BaseAgent(metaclass=ABCMeta):
prompt: ChatSequence = self.construct_prompt(instruction)
prompt = self.on_before_think(prompt, instruction)
- self.log_cycle_handler.log_cycle(
- self.ai_config.ai_name,
- self.created_at,
- self.cycle_count,
- prompt.raw(),
- CURRENT_CONTEXT_FILE_NAME,
- )
raw_response = create_chat_completion(
prompt,
self.config,