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.Asynchronous-generator loop
Expose incremental execution events.
incremental_event_streamRECORD STATUSCandidate · v0.1.0UML class view
The proposed contract drawn as participant roles, received calls, and numbered dependencies.
Object interactions
The same roles and calls as a class collaboration and a numbered message sequence.
Pointcut
Where the mechanism applies. All four dimensions belong to the proposed match, not just its vocabulary.
- 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.
Protected contract
The obligation that clients, operators, and auditors should be able to rely on.
- 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.
Variation & lifecycle
The hot spot is admitted only where the protected semantics survive.
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 + code design
An illustrative prompt and a small design sketch for the proposed contract. Names and APIs are invented; this is not a repository excerpt.
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.
Detection & matching
The frozen rule that retrieves this record, the canonical source exemplar, and the control that should stay unmatched.
- 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-python
src/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 ↗
Repository files
Up to five public files retrieved by the frozen cue and pinned to the audited commit. A match is a place to inspect, not a confirmed implementation.
src/agents/models/chatcmpl_stream_handler.py:603CANONICAL SOURCE02agno-agi/agnolibs/agno/agno/db/migrations/versions/v3_0_0.py:32RETRIEVAL CUE03anomalyco/opencodepackages/codemode/src/interpreter/generators.ts:35RETRIEVAL CUE04bytedance/deer-flowbackend/app/gateway/app.py:3RETRIEVAL CUE05cline/clineapps/cli/src/connectors/runtime-turn.ts:156RETRIEVAL CUEEvidence & provenance
Each layer answers a different question. Do not substitute retrieval for review.
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.
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 / 4186bd29878b30src/agents/models/chatcmpl_stream_handler.py:603tests/test_stream_events.py:1Async 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\bThis expression is a discovery instrument only. A match is a retrieval cue—not a confirmed implementation, pointcut match, or contract proof.