# Design an agent control loop that stays simple

> Prefer composable workflows first; promote to an agent only when the model must pick tools and stop conditions itself.

Source: https://fullbytedeveloper.com/blog/design-an-agent-control-loop
Published here: 2026-11-26

Most demos labeled "agent" are a fixed workflow with extra adjectives. Anthropic's Building effective agents post (2024-12-19) draws a clean line: workflows follow code paths you wrote; agents let the model choose tools and next steps from environmental feedback. Start on the workflow side until a fixed path cannot decide [1].

## Separate workflows from agents

Anthropic categorizes both as agentic systems, then distinguishes [1]:

- Workflows: LLMs and tools orchestrated through predefined code paths
- Agents: LLMs dynamically direct their own processes and tool usage, keeping control over how they accomplish the task

Write that distinction into your design doc before you pick a framework [1].

## Prefer simple composable patterns

Across customer builds, Anthropic says the most successful implementations used simple composable patterns [1]. Frameworks help you start, but they can obscure prompts and responses and make it tempting to add complexity when a smaller setup would work [1]. Start with LLM APIs directly; many patterns fit in a few lines of code [1].

## Climb the building blocks only when needed

Anthropic's building blocks, with a one-line when-to-use for each [1]:

| Pattern | When to use |
| --- | --- |
| Augmented LLM (retrieval, tools, memory) | Default building block for every call |
| Prompt chaining | Task splits cleanly into fixed subtasks; trade latency for accuracy |
| Routing | Distinct categories need different prompts or models |
| Parallelization (sectioning or voting) | Independent subtasks for speed, or multiple attempts for confidence |
| Orchestrator-workers | Subtasks cannot be listed up front (for example multi-file coding) |
| Evaluator-optimizer | Clear eval criteria exist and iteration measurably improves the answer |
| Agent loop | Open-ended path; number of steps hard to predict; you trust tool feedback |

Agentic systems often trade latency and cost for better task performance. Decide when that tradeoff is worth it [1]. For many applications, optimizing a single model call with retrieval and in-context examples is enough [1].

## Keep stop conditions in your code

A minimal control loop you own:

1. Model proposes the next tool call or a final answer
2. Your code runs only allowlisted tools
3. You append the tool result (ground truth) to the transcript
4. You stop on success criteria, max steps, budget, or a human gate

Teaching sketch (not a product agent):

```python title="control_loop.py"
def run_until_done(goal, tools, max_turns=8):
    messages = [{"role": "user", "content": goal}]
    for _ in range(max_turns):
        reply = call_model(messages, tools)
        if reply.is_final:
            return reply.text
        for call in reply.tool_calls:
            if call.name not in tools:
                raise ValueError(f"tool not allowlisted: {call.name}")
            result = run_tool(call.name, call.args)
            messages.append(tool_result(call.id, result))
    return "stopped: max turns"
```

Anthropic's agent section says agents typically are LLMs using tools based on environmental feedback in a loop, and that stopping conditions (such as a maximum number of iterations) keep control [1]. Keep those stops in code, not only in a prompt hope [1]. Design tool names and docs carefully; the post's appendix covers agent-computer interface details [1].

## When not to use an agent

Skip an autonomous loop when [1]:

- A single well-prompted call already solves the job
- Every branch is known and a workflow is enough
- You cannot afford the latency or cost of many turns
- You lack sandboxed tools and guardrails for compounding errors

Anthropic's three principles for agents: keep the design simple, show planning steps for transparency, and craft tool interfaces carefully [1].

## Managed Agents note (dated)

The December 2024 engineering post notes that product tooling has changed since then and points readers to Claude Managed Agents and its documentation for Anthropic's current managed product path [1]. Keep citing the engineering article for the workflow-vs-agent split and the building-block table; check Managed Agents docs when you adopt the hosted product [1].

Related: [What is an AI agent?](/blog/what-is-an-ai-agent) [2], [Stop an AI coding agent from over-engineering](/blog/stop-ai-coding-agent-over-engineering), [Anthropic planner, generator, evaluator pattern](/blog/anthropic-planner-generator-evaluator), [Five rules for building an AI agent that works](/blog/five-rules-for-effective-ai-agents), [Constrain AI coding agent scope](/blog/constrain-ai-coding-agent-scope).

Your next design review should name whether the piece is a workflow or an agent in Anthropic's sense, and list the stop conditions in code.

Send this to the teammate who opened with a multi-agent framework before writing a single tool allowlist.

## Sources

1. [Anthropic Engineering: Building effective agents (2024-12-19)](https://www.anthropic.com/engineering/building-effective-agents)
2. [What is an AI agent?](https://fullbytedeveloper.com/blog/what-is-an-ai-agent)
