Patterns
Loop Patterns and Paradigms
Autonomous Agent Systems Β· Loop Orchestration Β· Production Workflows

Loop Patterns and Paradigms

Heartbeats, crons, hooks, goals, and the distinction between open and closed loops

LOOP PATTERNS AND PARADIGMS

The Four Loop Patterns

Beyond the six primitives, loop engineering identifies four distinct trigger patterns. Most production agents combine more than one.

Pattern 1: Heartbeat Loop

The agent runs continuously on a short, fixed interval β€” checking for work each tick. This is the always-on assistant: a CI health dashboard, a PR monitor, a real-time issue tracker.

Cost profile: Highest fixed cost; price is set by frequency. Best for workflows where work is steady and low-latency response matters.

Pattern 2: Cron Loop

The agent runs on a defined schedule β€” daily, weekly, at a specific time. This is the pattern for batch work: morning standup prep, overnight dependency audits, weekly release notes.

Cost profile: Cheapest unless frequency is high. Best for predictable, time-anchored work.

Pattern 3: Hook Loop (Event-Driven)

The agent fires in response to an external event β€” a PR opens, a test fails, a deploy completes, a Slack message arrives, a web page changes. The agent is a component running continuously inside a larger system, waking only when there is something new to react to.

Failure mode: Webhook storms. A misconfigured vendor can push thousands of events in minutes, spawning thousands of agent runs. Every hook-triggered workflow needs a rate limit and a backpressure mechanism.

Pattern 4: Goal Loop

The agent runs continuously, prompting itself until a strictly defined outcome is validated. No heartbeat, no cron, no external trigger past the initial start. The agent decides each next step based on whether the goal has been met.

Canonical use: an autonomous research agent given the goal “produce a competitive analysis of the top five players in our space.” It searches, reads, summarizes, evaluates whether the brief is complete, decides what’s missing, searches more β€” until its own success check returns true.

Failure mode: Goals without convergence criteria. “Research the competitive landscape” doesn’t have a clear stopping condition. The agent runs indefinitely and burns tokens until someone notices.


Open Loops vs Closed Loops

A useful design distinction for production work:

Open Loops hand the agent a target plus guardrails and let it pick its own route through the problem. Good for prototyping, exploration, or unknown terrain. The catch: if the project’s standards are vague, the output is mostly noise.

Closed Loops map the route first β€” what each step does, how it is checked, when the loop is allowed to stop β€” and agents iterate inside that scaffolding. Runtime cost stays predictable, and results tend to improve over time because every run is graded against the same rubric.

In production, closed loops win by default. You keep one loop in charge of the goal, assign each step to dedicated specialist subagents, and let an automated check decide what gets through.

Interactive Tools

Practical tools to help you think systematically, build better AI agents, and master prompt engineering.

Future References

Explore these resources for deeper learning on AI agent development, spec-driven development, and prompt engineering tools.

Spec-Driven Development

Comprehensive guide on Spec-Driven Development practices and methodologies.

Awesome Copilot

Curated list of GitHub Copilot resources, extensions, and best practices.

Promptfoo

Tool for testing, evaluating, and improving LLM prompts and applications.

Prompts.chat

Collection of prompt engineering resources and templates.

Agent Skills

Agent skills resources and documentation for building AI agent skills.

Awesome Skills

Curated list of awesome skill repositories and collections.

Agent Skills Topic

GitHub topic for discovering agent-related skills and repositories.

AI Agent Topic

Trendshift topic for discovering AI agents.

AI Skills Topic

Trendshift topic for discovering AI skills.

Agent Governance Toolkit

Agent governance toolkit.

Pattern Sources

Our patterns are curated from industry-leading sources with proper attribution and licensing compliance.

Refactoring.Guru

Classic GoF design patterns, code smells catalog, and refactoring techniques (https://refactoring.guru).

Enterprise Integration Patterns

65 messaging patterns for integrating enterprise applications by Gregor Hohpe and Bobby Woolf (CC BY 4.0).

Microservices.io

Comprehensive patterns for microservice architectures by Chris Richardson.

Agent Catalog Patterns

Patterns for agentic systems from agentpatternscatalog.org (CC BY 4.0).

OWASP Foundation

Security patterns from OWASP Top 10 for Web Applications, LLM Applications, and Agentic Applications (CC BY-SA 4.0).

Industry Research

ML/AI patterns from Microsoft, Google, Anthropic, and academic research.

AI Agent Patterns

Spec-driven development patterns from Claude, Gemini, OpenAI, and GitHub Copilot on github/spec-kit and OpenSpec.

Data Engineering Leaders

Data platform patterns from Martin Fowler (Data Mesh), Kimball Group (Dimensional Modeling), and cloud providers.

MLOps Best Practices

Data science patterns from MLflow, Great Expectations, and MLOps practitioners.

Streaming & Analytics

Real-time patterns from Confluent/Kafka, Apache projects, and serverless analytics platforms.

Academic Papers

Rigorous ML patterns from peer-reviewed research including data leakage prevention and active learning.

5-Day AI Agents Course

Intensive Vibe Coding Course With Google by Brenda Flynn et al. (2026) on Kaggle.

The Agent Loop

Foundational Agent Definition (Perceive + Act):
Russell, S. J., & Norvig, P. (1995). Artificial Intelligence: A Modern Approach. Prentice Hall. (Current edition: 4th Ed., Pearson, 2020)

Modern Iterative LLM Agent Loop:
Yao, S., Zhao, J., Yu, D., et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. arXiv:2210.03629.

Historical Context:
Incorporating AIMA's perceive/act model, Classical robotics' Sense-Plan-Act loop (Brooks, 1986), and ReAct's Thought→Action→Observation cycle.