Skip to content

Let the agent own the loop

So I came up with a new way to write tool agents last week. Prevents repetitive looping. Most systems today do it backwards.

The way looping usually works, is that it's controlled by a dumb system. The dumb system starts and continues the loop procedurally, which causes a lot of problems we have to work around every day. Agents getting lost in their loops, agents getting confused and forgetting to emit a final command, and repeating themselves forever. And all this is complicated with quirks in labelling and tool responses.

The better way to do this, is to let the agent start the loop by emitting an async command, and only continuing the loop as long as the agent intentionally continues it.

If you've ever done content management work, this will feel familiar.

I'm including the hooks and tagging system that facilitates it, along with a demo on how to use it.

Have fun!

https://github.com/LynnColeArt/captainhook