From 397627d1b9d77b820d1eae0b5b20642aa9b00eb9 Mon Sep 17 00:00:00 2001 From: BillSchumacher <34168009+BillSchumacher@users.noreply.github.com> Date: Sun, 16 Apr 2023 00:01:23 -0500 Subject: [PATCH] add post_instruction hook --- autogpt/agent/agent_manager.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autogpt/agent/agent_manager.py b/autogpt/agent/agent_manager.py index 1c811f86..3db2fdd6 100644 --- a/autogpt/agent/agent_manager.py +++ b/autogpt/agent/agent_manager.py @@ -58,7 +58,10 @@ class AgentManager(metaclass=Singleton): self.agents[key] = (task, messages, model) - return key, plugins_reply + for plugin in self.cfg.plugins: + agent_reply = plugin.post_instruction(agent_reply) + + return key, agent_reply def message_agent(self, key: Union[str, int], message: str) -> str: """Send a message to an agent and return its response @@ -98,7 +101,10 @@ class AgentManager(metaclass=Singleton): if plugins_reply and plugins_reply != "": messages.append({"role": "assistant", "content": plugins_reply}) - return plugins_reply + for plugin in self.cfg.plugins: + agent_reply = plugin.post_instruction(agent_reply) + + return agent_reply def list_agents(self) -> List[Tuple[Union[str, int], str]]: """Return a list of all agents