diff --git a/agency_swarm/agents/agent.py b/agency_swarm/agents/agent.py index 35b55ea1..1bc90792 100644 --- a/agency_swarm/agents/agent.py +++ b/agency_swarm/agents/agent.py @@ -465,13 +465,16 @@ def get_settings_path(self): return self.settings_path def _read_instructions(self): - class_path = os.path.normpath(os.path.join(self.get_class_folder_path(), self.instructions)) + class_instructions_path = os.path.normpath(os.path.join(self.get_class_folder_path(), self.instructions)) if os.path.isfile(self.instructions): with open(self.instructions, 'r') as f: self.instructions = f.read() - elif os.path.isfile(class_path): - with open(class_path, 'r') as f: + elif os.path.isfile(class_instructions_path): + with open(class_instructions_path, 'r') as f: self.instructions = f.read() + elif "./instructions.md" in self.instructions or "./instructions.txt" in self.instructions: + raise Exception("Instructions file not found.") + def get_class_folder_path(self): try: