What is AgentLoop?
AgentLoop is a ready-to-use agent that packages everything you need to run an autonomous coding task: tools, system prompt, turn limits, cost limits, session memory, and observability. Under the hood it delegates to Spring AIβs ChatClient + AgentLoopAdvisor for the actual tool-calling loop.
Think of it as βbatteries includedβ β one class, one builder call, working agent:
Built-in Tools
AgentLoop ships with a full set of SWE tools:Configuration
AgentLoop.Config is a Java record with a builder:
Configs are immutable records. Use
toBuilder() to derive variants:
Session Memory
Enable session memory to preserve conversation context across multiple calls:ChatMemory implementation:
Interactive Mode
For TUI/CLI applications, interactive mode enables human-in-the-loop viaAskUserQuestionTool:
Result
AgentLoop.Result is a record with execution details:
Observability
AgentLoop wires Micrometer observations for tool call tracking. You can also provide a customToolCallListener:
Relationship to LoopPattern
AgentLoop is not a LoopPattern implementation. Itβs a higher-level construct:
LoopPatternβ the abstract interface for loop algorithms (TurnLimitedLoop,EvaluatorOptimizerLoop,StateMachineLoop). Lives inworkflow-api.AgentLoopβ a concrete, runnable agent that usesAgentLoopAdvisorinternally. Lives inworkflow-agents.
AgentLoop is what you use when you want to run an agent. LoopPattern is what you implement when you want to create a new loop algorithm.