MCPcopy Create free account
hub / github.com/SamuelSchmidgall/AgentLaboratory / run_code

Method run_code

mlesolver.py:553–562  ·  view source on GitHub ↗

Actually execute the code that was generated @return: (str) code return

(self)

Source from the content-addressed store, hash-verified

551 return f"\nYou also have access to tools which can be interacted with using the following structure: ```COMMAND\n<command information here>\n```, where COMMAND is whichever command you want to run (e.g. EDIT, REPLACE...), <command information here> is information used for the command, such as code to run or a search query, and ``` are meant to encapsulate the command. ``` must be included as part of the command both at the beginning and at the end of the code. DO NOT FORGOT TO HAVE ``` AT THE TOP AND BOTTOM OF CODE. and this structure must be followed to execute a command correctly. YOU CAN ONLY EXECUTE A SINGLE COMMAND AT A TIME! Do not try to perform multiple commands EVER only one. {self._common_code_errors()}" + cmd_strings
552
553 def run_code(self):
554 """
555 Actually execute the code that was generated
556 @return: (str) code return
557 """
558 if self.prev_code_ret is not None:
559 return self.prev_code_ret
560 elif self.should_execute_code:
561 return execute_code("\n".join(self.code_lines))
562 return "Changes have not yet been made to the code."
563
564
565

Callers

nothing calls this directly

Calls 1

execute_codeFunction · 0.85

Tested by

no test coverage detected