Catalog/P family/P05
Proposed specificationSource-located exemplarH1

Asynchronous-generator loop

Expose incremental execution events.

JOIN POINTincremental_event_streamRECORD STATUSCandidate · v0.1.0
UML class view for Asynchronous-generator loop, showing participant roles, received calls, and analytical dependencies
FIG. P05 / UML CLASS VIEW
Object interaction diagram for Asynchronous-generator loop, showing role collaboration and a numbered message sequence
FIG. P05 / OBJECT INTERACTIONS
Context
A consumer observes an agent run incrementally.
Trigger
The runtime emits a semantic event or streamed token.
Structure
Async yield/resume, cancellation, and cleanup ownership.
Effect
Consumers receive ordered events and early exit releases runtime resources.
Requires
The producer exposes an async iterator or equivalent streaming boundary.
Ensures
Each emitted event has a stable type and sequence context.
Invariant
Cancellation and producer failure do not leave unreleased work.
Violation
Abandoned consumers trigger cancellation or documented cleanup.

Negative control

A synchronous list returned at the end is not the streaming pointcut.

Permitted variation

Stream event schema, backpressure, buffering, and consumer adapters.

Test obligation

Test event order, consumer cancellation, producer exception, and cleanup.

Evolution question

Did streaming become a first-class typed event surface?

PROMPT SKETCH
Consume the producer as an async stream. Preserve event type and sequence context, propagate cancellation, and run cleanup on every exit path, including consumer failure.
CODE DESIGN / PYTHON
async def consume(producer, consumer):
    try:
        async for event in producer:
            await consumer.handle(event)
    except asyncio.CancelledError:
        await producer.aclose()
        raise
    finally:
        await consumer.close()

Illustrative design sketch. The stream boundary owns cancellation and cleanup; buffering is an implementation choice. This example is a teaching aid, not implementation evidence or a conformance claim.

Join point
incremental_event_stream
Source locator
Barbaste et al., §6.2, p. 15 (Gemini CLI, “Async-Generator Loop”); source label
Lexical cue
(?i)\basync\s+def\s+\w+\([^\n]*\).*?yield\b|\basync\s+function\s*\*|\bAsyncGenerator\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.
Aliases
None
Canonical exemplar
openai/openai-agents-pythonsrc/agents/models/chatcmpl_stream_handler.py:603Support: tests/test_stream_events.py:1
Negative control
A synchronous list returned at the end is not the streaming pointcut.

Scope-anchored review. pohe-agent analyze <repo> --pattern P05 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 COVERAGE25/36

69.4% 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: 28 / 41
Canonical source anchoropenai/openai-agents-python 86bd29878b30src/agents/models/chatcmpl_stream_handler.py:603

Async generator yields incremental response events.

Exploratory retrieval cue Regex / v0.1.0
(?i)\basync\s+def\s+\w+\([^\n]*\).*?yield\b|\basync\s+function\s*\*|\bAsyncGenerator\b

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