Error objects are used to communicate errors to the decision agent/tool calls. When yielded, Error objects are automatically saved inside the TreeData object. When calling the same tool again, the saved Error object is automatically loaded into any tool calls made with the same tool nam
| 925 | |
| 926 | |
| 927 | class Error(Update): |
| 928 | """ |
| 929 | Error objects are used to communicate errors to the decision agent/tool calls. |
| 930 | When yielded, Error objects are automatically saved inside the TreeData object. |
| 931 | When calling the same tool again, the saved Error object is automatically loaded into any tool calls made with the same tool name. |
| 932 | All errors are shown to the decision agent to help decide whether the tool should be called again (retried), or a different tool should be called. |
| 933 | """ |
| 934 | |
| 935 | def __init__(self, feedback: str = "", error_message: str = ""): |
| 936 | """ |
| 937 | Args: |
| 938 | feedback (str): The feedback to display to the decision agent. |
| 939 | Usually this will be the error message, but it could be formatted more specifically. |
| 940 | """ |
| 941 | self.feedback = feedback |
| 942 | self.error_message = error_message |
| 943 | |
| 944 | if feedback == "": |
| 945 | self.feedback = "An unknown issue occurred." |
| 946 | |
| 947 | Update.__init__( |
| 948 | self, |
| 949 | "self_healing_error", |
| 950 | {"feedback": self.feedback, "error_message": self.error_message}, |
| 951 | ) |