Skip to main content

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:
You can also pass a custom ChatMemory implementation:

Interactive Mode

For TUI/CLI applications, interactive mode enables human-in-the-loop via AskUserQuestionTool:

Result

AgentLoop.Result is a record with execution details:

Observability

AgentLoop wires Micrometer observations for tool call tracking. You can also provide a custom ToolCallListener:

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 in workflow-api.
  • AgentLoop β€” a concrete, runnable agent that uses AgentLoopAdvisor internally. Lives in workflow-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.

Maven Coordinates