Catalog/P family/P01
Proposed specificationSource-located exemplarH1

Minimal linear loop

Alternate model turns and action execution.

JOIN POINTagent_turn_executionRECORD STATUSCandidate · v0.1.0
UML class view for Minimal linear loop, showing participant roles, received calls, and analytical dependencies
FIG. P01 / UML CLASS VIEW
Object interaction diagram for Minimal linear loop, showing role collaboration and a numbered message sequence
FIG. P01 / OBJECT INTERACTIONS
Context
A harness executes an agent with at least one model or action turn.
Trigger
A model response requests tools or another turn.
Structure
Ordered turn/result records and an explicit repeat-or-terminate decision.
Effect
Every turn yields a terminal result, a tool action, or another legal turn.
Requires
Model output, action dispatch, and a termination predicate are available.
Ensures
Actions are correlated with their turn and a terminal outcome is returned.
Invariant
Each completed turn has one recorded decision and no unexplained action.
Violation
Premature stop, malformed action, or repeated retry must terminate or surface an error.

Negative control

A one-shot model call with no action cycle does not satisfy the pointcut.

Permitted variation

Prompt, tool set, stopping predicate, and turn result encoding.

Test obligation

Test normal completion, immediate malformed output, and retry exhaustion.

Evolution question

Has the loop moved from ad hoc control to a typed runner or state machine?

PROMPT SKETCH
Work in a bounded loop. On each turn: call the model, execute any requested tool actions, record each observation, then ask the termination policy whether to continue. Return exactly one terminal result, or stop with a typed exhaustion error.
CODE DESIGN / PYTHON
def run(task, model, tools, policy):
    history = [user_message(task)]
    for turn in range(policy.max_turns):
        reply = model.respond(history)
        history.append(reply.as_message())
        for action in reply.tool_calls:
            observation = tools.execute(action, turn=turn)
            history.append(observation.as_message())
        decision = policy.decide(history, turn)
        if decision.stop:
            return decision.result
    raise LoopExhausted(turns=policy.max_turns)

Illustrative design sketch. The runner, not the prompt, owns turn identity and the terminal decision. This example is a teaching aid, not implementation evidence or a conformance claim.

Join point
agent_turn_execution
Source locator
Barbaste et al., §6.2, p. 14 (Mini-SWE-Agent, “Minimal Linear Loop”); source label
Lexical cue
(?i)\bwhile\s+(?:true|not\s+done)|\bmax_(?:turns|steps|iterations)\b|\brun_(?:loop|until)\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.
Aliases
None
Canonical exemplar
openai/openai-agents-pythonsrc/agents/run_internal/run_loop.py:987Support: tests/test_agent_runner.py:1
Negative control
A one-shot model call with no action cycle does not satisfy the pointcut.

Scope-anchored review. pohe-agent analyze <repo> --pattern P01 anchors the cue to its enclosing declaration and checks a separate operational signature for all four pointcut dimensions. Missing roles and negative-control risks remain visible; a structural match is not E2/E3. Calibration report ↗

Source-located exemplar

A concrete source anchor is available for this proposed record. It is one exemplar, not evidence that all repositories—or every contract field—conform.

Review boundary: this candidate and its specification come from an AI-assisted study. Independent human validation remains open.

ANY-EVIDENCE FAMILY COVERAGE35/36

97.2% of repository families in the frozen panel have at least one current cue, historical cue, or canonical source layer. This is not confirmed prevalence.

Current lexical-cue repositories: 39 / 41
Canonical source anchoropenai/openai-agents-python 86bd29878b30src/agents/run_internal/run_loop.py:987

Explicit agent turn/tool streaming loop.

Exploratory retrieval cue Regex / v0.1.0
(?i)\bwhile\s+(?:true|not\s+done)|\bmax_(?:turns|steps|iterations)\b|\brun_(?:loop|until)\b

This expression is a discovery instrument only. A match is a retrieval cue—not a confirmed implementation, pointcut match, or contract proof.