The Agentic Sense-Plan-Act Loop
In a previous post on defining intelligence, we noted that intelligence can be characterized by how an entity perceives the world, processes that information, and subsequently acts on that perception. Today, the term “agentic” has become ubiquitous in the Artificial Intelligence (AI) vernacular, often used to describe Large Language Models (LLMs) equipped with tool-use loops, memory, and reasoning scaffolds. Yet while software agents feel like a new paradigm, the fundamental architecture governing how an autonomous system interacts with an external environment is over half a century old. In robotics, this paradigm is known as the Sense-Plan-Act (SPA) loop[1].
Whether an agent is embodied in physical hardware navigating a crowded hallway[2] or operating purely in digital environment performing tasks like coding, its “intelligence” is characterized by closed-loop feedback with its environment. Formally, at any given timestep , an agent executes a policy (or samples from a stochastic policy ) that maps an internal belief state to an action , which in turn alters the state of the environment at some frequency .
We can decompose the policy into three stages, Sense-Plan-Act (SPA):
- Sense: Translating raw environmental observations into structured geometric or semantic representations and maintaining a belief over the world state[3].
- Plan: Computing a sequence of future states or trajectories that progress toward an objective while respecting environmental and system constraints[4].
- Act: Transforming high-level plans into low-level, executable commands that directly change the state of the environment[5].
Example 1: Embodied Robotic Navigation
Consider a 1/10th-scale autonomous vehicle tasked with navigating through an indoor environment1. The environment is governed by continuous dynamics, sensor noise, and non-holonomic kinematic constraints (Ackermann steering geometry).
In a classical robotics stack, the SPA loop is explicitly decomposed into specialized modules orchestrated via middleware like ROS 2[6]:
- Sense: The robot ingests raw distance information (LiDAR scans), images (RGB camera frames), and acceleration information (inertial measurement unit). Using Simultaneous Localization and Mapping (SLAM)[7] and Adaptive Monte Carlo Localization (AMCL), a robot estimates its position in the environment and builds a map containing obstacles in the environment.
- Plan: A global planner runs a graph search algorithm like over the map to find an optimal path to the goal. Simultaneously, a local planner samples kinematically feasible local trajectories nearby the robot to avoid dynamic obstacles, such as pedestrians.
- Act: A low-level controller (such as pure pursuit or a PID loop running on a motor controller) translates the local trajectory’s target velocities into electrical current commands for the drive motor and steering servo. The car moves in the environment and the loop repeats at the next Sense step.
Example 2: Autonomous Coding Agents
Consider a software engineering agent tasked with fixing a bug in a large codebase. Although the agent lacks a physical body, its interaction with the compute environment (file systems, compilers, test runners, and version control) follows the same Sense-Plan-Act loop. Instead of running at a fixed control frequency, the loop ticks at the rate of LLM token generation and subprocess execution.
- Sense: The agent observes its environment by reading file contents, parsing Abstract Syntax Trees (ASTs), searching the repository via
grepor embeddings, and ingestingstdout/stderrstack traces from test suites. Observations update the agent’s internal belief state, which is maintained within the LLM’s context window. - Plan: Conditioned on the context window, the model reasons over the root cause of the bug (often externalized via Chain-of-Thought or tree search) and formulates a multi-step strategy: which files need modification, what edge cases must be handled, and how the fix will be verified.
- Act: The agent emits structured tool calls such as applying a
diffpatch to a file, executing a bash command to runpytest, or invoking a code-formatting tool. Commands are executed and return new compiler outputs or test results, which are observed during the next Sense step.
Beyond Token Generation to Agentic Systems
To understand why the Sense-Plan-Act loop makes AI so much more capable, consider how a standard language model works on its own. When you give a chatbot a prompt, it generates a response word by word based only on its training data and the provided text. In robotics, this is like walking across a crowded room with your eyes closed: you might have a good initial mental map, but a single misstep early on compounds over time because you have no way to see where you actually are[8]. Because the model cannot check its work against observations of the environment, it is limited to whatever it can do in the first try.
Using the model as an agent allows it to observe and reason about an environment[9]. Instead of treating the generated text as the answer, an agent uses the output text to take actions, such as editing a file, running a test, or moving a motor. The ability to act allows the agent to influence the world, which produces feedback (via sensing), such as an error message or a new camera frame. Through sensing, the agent can reason about what went wrong, update its plan, and try again. It no longer needs to make a perfect prediction on the first attempt. By repeatedly acting, observing the outcome, and course-correcting, an agent can iteratively solve complex problems that would be impossible to solve in a single pass.