chapter nine

9 Understanding the Agentic Loop

 

This chapter covers

  • Peeling back the three agentic loop layers
  • Looping with a deep research agent
  • Multi-agent orchestration loops
  • Building collaboration agentic loops

Way back in chapter 1, we explored the core agentic loop pattern, which we referred to as the SPAL (Sense-Plan-Act-Learn) process loop. In this chapter, we look beyond the internal agent loop to looping patterns that extend outside the agent. These patterns are used to formulate long-horizon, goal-driven agents, such as those involved in deep research or, more collectively, in what’s called the agent collaboration workflow.

Using agentic looping to empower agents introduces new levels of command and control in both single- and multi-agent systems. This chapter will explore the three layers of the agent loop, from the internal loop (SPAL)we already know about, to long-horizon goal execution, and meta-guided looping in multi-agent systems. Along the way, we will look at practical applications of each layer and how you can introduce these patterns into your agentic workflows.

9.1 Peeling back the three agentic loop layers

The internal look (SPAL) is the first or core layer of an agent. This loop allows an agent to iterate, discover, reason, and execute tasks to complete goals. But there are two more agentic loop layers that can extend the work of the agent: layer two, the task loop; and layer 3, the meta-loop.

9.1.1 Layer one – the inner loop (Sense-Plan-Act-Learn)

9.1.2 Layer two – the task loop

9.1.3 Layer three – the meta loop

9.2 Layer 2 - Looping with a Deep Research Agent

9.2.1 Creating the initial state and plan

9.2.2 Adding the tools

9.2.3 Understanding iteration body output

9.2.4 The termination gate

9.2.5 Coding the deep research loop

9.2.6 Synthesizing the final output

9.2.7 When to use an agentic loop

9.2.8 Building a repetitive task loop agent

9.3 Layer 3 – Multi-agent orchestration loops

9.4 Building collaboration agentic loops

9.5 Exercises

9.6 Summary