What is an Agent Loop?
The agent loop is the fundamental execution cycle of an AI agent: observe the current state, think about what to do (using an LLM), take an action (call a tool), observe the result, and repeat until the task is complete or a stop condition is met.
WHY IT MATTERS
Every AI agent, regardless of framework or architecture, runs some variant of the agent loop. At its simplest: get user input → call LLM → if LLM wants to use a tool, execute it → feed result back to LLM → repeat until LLM returns a final response.
The agent loop is deceptively simple but the details matter. How many iterations before you force a stop? How do you handle tool execution failures? When do you escalate to a human? These decisions shape agent behavior more than the choice of LLM.
For financial agents, the loop is where spending happens. Each iteration could trigger a transaction. Without controls, a runaway loop could execute dozens of transactions in seconds — burning through a budget before anyone notices.
HOW POLICYLAYER USES THIS
PolicyLayer intercepts the 'act' phase of the agent loop for financial operations. Before any transaction executes, it passes through policy validation. This adds a policy checkpoint to every iteration of the loop without modifying the agent's core logic.