TransformerOptimus / SuperAGI

<⚡️> SuperAGI - A dev-first open source autonomous AI agent framework. Enabling developers to build, manage & run useful autonomous agents quickly and reliably.
https://superagi.com/
MIT License
15.22k stars 1.83k forks source link

Loop detection and handling #41

Open eqxwow opened 1 year ago

eqxwow commented 1 year ago

If Agent goes into a loop, it should detect it and find ways to come out of it and proceed to the next step.

neelayan7 commented 1 year ago

Interesting. Any pointers on how to go ahead with this?

fkcptlst commented 1 year ago

Literally solving it could be difficult because it's equivalent to the halting problem. The possible solution could be engineering workarounds such as putting a hard time limit etc.

Mickelodian commented 1 year ago

how about on each iteration it examines if it has previously carried out this task, the result and so on, and if it concludes it is carrying out, or intends to carry out a routine that has failed before, twice... it stops and reexamines the goal. The halting problem you see is trying to get out of a loop from inside the loop. This current issue with SuperAGI however is simply looking at the loop from outside the loop. I'm not a fan of counters or hard coded time limits. I'm not sure first that its a scalable idea on lengthy, or especially on complex tasks, nor is it elegant.

The important thing is to ensure the previous attempt is held in embeddings in pinecone perhaps, even locally on the users workspace OR that all tasks are counted anyway... even the successful ones.

Its just an idea, but how about a 'sign off agent' that evaluates all tasks completed and a function that returns 'if the task worked'. If it did not work then it not working itself becomes a task and the model is tasked with finding out WHY it didn't work.

whybeyoung commented 1 year ago

can we submit this problem to an AI, i mean we can design a role named watcher, It is responsible for monitoring the entire task execution process, recording the number of cycles, and the deviation of the target. Let AI judge it and give it some exit forms similar to strategies, instead of directly limiting the number of cycles.