The Agentic Loop: Three loops in a trench coat

This technical post breaks down the architecture of 'agentic' AI systems into three distinct loops: inference, tool usage, and chat history management. It provides a conceptual framework for developers building autonomous AI agents.
Why it matters
It provides a foundational understanding of how modern AI agents are engineered to perform complex, multi-step tasks.
Agent loops are often oversimplified. They’re presented as a single loop, when really it’s three loops in a trench coat that make up an “agentic” experience for a customer. I’m here to write (yes, I wrote this, insane right?) yet-another-blog about agent loops. The example code blocks are also pseudo-code and for illustrating these ideas. Also I’ve omitted streaming, which complicates the post but the shape of these stays the same.
The content is purely technical and educational, focusing on software architecture.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in