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 ...
Read more at sketch.dev