How does an LLM become an Agent?
LLM are stateless, they predict the next token based on a sequence of previous tokens. They dont have memory between calls, no ability to execute code, and no way to reach the outside world. So how do Agents autonomously call tools and make decisions?
The answer is surprisingly simple: a loop. Your application code sends a request to the LLM, parses the response, and if the model requested a tool call, executes it locally, appends the result to the conversation, and calls the LLM again. The “intelligence” lives in the model; the “agency” lives in the loop. The diagram below illustrates this.