Get the latest tech news

The unreasonable effectiveness of an LLM agent loop with tool use


2025-05-15 by Philip Zeyliger My co-workers and I have been working on an AI Programming Assistant called Sketch for the last few months. The thing I've been most surprised by is how shockingly simple the main loop of using an LLM with tool use is: def loop(llm): msg = user_input() while True: output, tool_calls = llm(msg) print("Agent: ", output) if tool_calls: msg = [ handle_tool_call(tc) for tc in tool_calls ] else: msg = user_input() There's some pomp and circumstance to make the above work (here's the full script) ), but the core idea is the above 9 lines.

With just that one very general purpose tool, the current models (we use Claude 3.7 Sonnet extensively) can nail many problems, some of them in "one shot." Seeing the LLM struggle with sed one-liners re-affirms that visual (as opposed to line) editors are a marvel. I keep thinking of how much time I've spent correlating stack traces with git commits, and how good LLMs are at doing a first pass on it.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of tool use

tool use

Photo of agent loop

agent loop

Related news:

News photo

Show HN: Magenta.nvim – AI coding plugin for Neovim focused on tool use