Patterns
Execution Surfaces and Verification
Autonomous Agent Systems Β· Loop Orchestration Β· Production Workflows

Execution Surfaces and Verification

Coupled and decoupled execution models, verification strategies, and self-grading risks.

EXECUTION SURFACES AND VERIFICATION

5. Execution Surfaces and the Enterprise Cost Model

Where a loop physically executes determines two things an enterprise platform team must own: whether a machine needs to stay awake, and which billing or resource-allocation contract governs the run. Four surfaces span an escalating autonomy gradient:

SurfaceCharacteristicsMachine stateTypical billing route
In-sessionInteractive, prototypingAwake, session openSubscription / allocated seat
Desktop scheduled taskIndependent session per run, fresh context each timeMust remain awake (with a catch-up window on wake)Subscription
Cloud routineRuns on managed infrastructure, laptop can be offN/ACurrently subscription, policy in flux
Headless / SDK / CI integrationFully decoupled automationN/APer-token API billing

The practical guidance for enterprise platform design: prototype in-session, promote proven loops to a scheduled surface for daily use, and only fall through to a fully decoupled headless or SDK path when automation must run independent of any interactive account context (for example, triggered by a CI event on a shared service account). This “promotion path” β€” session β†’ scheduled task β†’ managed routine β†’ headless β€” mirrors the maturity curve most enterprises already apply to moving a script from a laptop to a scheduled job to a managed pipeline, and it is worth encoding as policy rather than leaving to individual engineer discretion.

A specific cost-control finding worth flagging to any FinOps or platform-cost function: headless, non-interactive invocation of an agent can silently route to per-token API billing even under an otherwise-unlimited subscription arrangement, if the invocation environment happens to carry API credentials. Enterprises building scheduled or CI-triggered agentic automation should verify the active billing route before wiring anything into a cron-style trigger, and should treat “which contract is this landing on” as a pre-deployment checklist item, not an assumption. One documented incident saw a subscriber accumulate several thousand dollars in unexpected per-token charges over two days by scheduling headless invocations that silently fell onto the API billing path rather than the subscription pool they believed covered it.

Because this policy area moves quickly β€” billing boundaries between subscription and API-metered usage were adjusted, paused, and are expected to shift again β€” any cost model built into an internal platform should be re-verified against current vendor documentation before being treated as load-bearing, and should never be hard-coded into automation without a periodic revalidation step.


6. Verification: The Central Architectural Decision

If a single decision determines whether an enterprise’s agentic loops are trustworthy, it is this one: the agent that produces work and the agent that judges it must be separate.

6.1 Why self-grading fails

A single model instance evaluating its own output exhibits the same bias a human author exhibits reviewing their own draft: it will find what it expects to find, and it will not surface its own blind spots. This is not a capability gap that improves with a better model β€” it is a structural property of self-assessment. The fix is architectural, not a matter of prompting the model to “be more critical.”

6.2 What real verification requires

A verification step is only meaningful if it could plausibly fail even when the producing agent is confident the work is correct. Re-running the same unit tests the producing agent wrote inherits that agent’s blind spots β€” if the tests encode a misunderstanding, so does their re-execution. Stronger verification strategies, roughly ordered from weakest to strongest:

  • Independent test execution with raw output β€” not a summary, the actual output, pasted into the transcript.
  • User-level exercise of the feature β€” starting the service and driving the actual path a change claims to fix, rather than trusting internal assertions.
  • Golden or snapshot comparison against a known-good fixture.
  • Property-based or fuzz testing β€” invariants checked against generated inputs rather than hand-picked cases that the author may have unconsciously chosen to pass.
  • Schema or contract validation against a published interface definition.
  • Visual regression for UI-facing changes.
  • Independent re-derivation β€” a second agent solving the problem by a different method, with results compared. This is particularly valuable for financial or numerical logic, where a test suite written by the same author who wrote the calculation will often encode the same misunderstanding as the calculation itself.
  • Lint, type, and build checks β€” necessary as a floor, but never sufficient as proof of correctness on their own.

An enterprise checker agent’s system prompt should explicitly instruct it to trust nothing it cannot reproduce itself, and to report a failing verdict with specific reproduced evidence rather than accepting the producing agent’s description of its own work. The strongest possible design gates the loop’s completion condition on the checker’s independently reproduced pass β€” not on the producing agent’s self-report β€” so the loop structurally cannot terminate on a self-assessment.

6.3 Verifying the right thing

The subtle and recurring failure is a checker that verifies a proxy for the goal rather than the goal itself: tests that pass without covering the actual defect, a green build that says nothing about runtime behavior, a lint pass mistaken for correctness. The diagnostic question worth institutionalizing in code review and platform design alike: if this check passes and the feature is still broken, what did the check fail to catch β€” and then add the check that would have caught it.

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.