forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyour_agent.py
More file actions
29 lines (26 loc) 路 934 Bytes
/
Copy pathyour_agent.py
File metadata and controls
29 lines (26 loc) 路 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class YourAgent:
def __init__(self, name):
self.name = name
self.lessons = {}
def run(self, task, lesson=None):
# Simulate running the task
if lesson:
# Use the provided lesson to improve performance
print(f"Running {task} with lesson: {lesson}")
return "success"
else:
# Run the task without any prior knowledge
print(f"Running {task} without any prior knowledge")
return "failure"
def get_lesson(self, result):
# Simulate extracting a lesson from the result
if result == "success":
return f"Lesson learned from {result}"
else:
return None
if __name__ == "__main__":
agent = YourAgent("YourAgent")
result = agent.run("Task A")
lesson = agent.get_lesson(result)
result = agent.run("Task B", lesson=lesson)
print(f"Final result: {result}")