← Reference · Nestor G Pestelos Jr · Print this page

Systems Architecture · Artificial Intelligence

Agentic Loops

Reference entry · last updated 20260910

An agentic loop is a repeated execution cycle in which an AI agent uses observations from its environment to choose subsequent actions toward a task.[1]

Previous version, captured 20260910

First principles and definitions

In Anthropic’s distinction, workflows follow predefined code paths; agents dynamically direct their tool use. A workflow can contain a retry loop without delegating action selection to a model.[1] Feedback can change the next action, but does not guarantee progress or a correct result.

The agent harness executes tool calls and manages the surrounding runtime. Trivedy includes orchestration logic within the harness.[2] Prompt engineering shapes instructions; context engineering determines the information available during execution.

Illustrative control flow. The host can interrupt execution independently of the model.

Worked example

This illustrative research task uses read-only tools: find the publication year of a named paper and return its source.

  1. The agent searches the title and receives several candidate records.
  2. It opens the matching publisher record to check the title and year.
  3. If the record describes a different edition, that observation changes its next search.
  4. It returns the verified year and citation, or reports the unresolved question when its search limit is reached.

The changed query demonstrates feedback-driven action selection. The example does not require a filesystem write or another external mutation.

Architecture patterns

These patterns describe different responsibilities, not ranked autonomy levels.

Weng describes planning, memory, and tool use as components of an LLM-powered agent.[5]

Design considerations

Anthropic recommends starting with the simplest effective system and weighing added cost and latency against performance.[1] Task frequency affects that tradeoff; it is not a definition of an agentic loop.

The following stopping and recovery rules are illustrative engineering policies, not requirements of ReAct or Reflexion.

Failure modes and stopping

A fail-closed policy can stop restricted actions when authorization cannot be established. Cancellation, hard limits, and tool permissions should remain enforceable even when the model proposes continuing.

See also

References

  1. Anthropic. “Building effective agents.” 2024.
  2. Trivedy, Vivek. “The Anatomy of an Agent Harness.” LangChain, 2026.
  3. Yao, Shunyu, et al. “ReAct: Synergizing Reasoning and Acting in Language Models.” ICLR, 2023. Author project page.
  4. Shinn, Noah, et al. “Reflexion: Language Agents with Verbal Reinforcement Learning.” NeurIPS, 2023. Full text.
  5. Weng, Lilian. “LLM Powered Autonomous Agents.” 2023.
  6. Amazon Web Services. “Making retries safe with idempotent APIs.” Amazon Builders’ Library.