Catalog/P family/P02
Proposed specificationSource-located exemplarH1

Streaming concurrent batch loop

Overlap output and independent work.

JOIN POINTparallel_invocation_batchRECORD STATUSCandidate · v0.1.0
UML class view for Streaming concurrent batch loop, showing participant roles, received calls, and analytical dependencies
FIG. P02 / UML CLASS VIEW
Object interaction diagram for Streaming concurrent batch loop, showing role collaboration and a numbered message sequence
FIG. P02 / OBJECT INTERACTIONS
Context
Multiple model, tool, or batch tasks are authorized to run concurrently.
Trigger
A batch is dispatched or streamed.
Structure
Invocation identity, cancellation control, and result correlation.
Effect
Streamed or completed results are merged without losing or duplicating ownership.
Requires
The runtime exposes concurrency and a way to await or cancel outstanding work.
Ensures
Every accepted invocation is linked to its result or explicit failure.
Invariant
The harness does not declare completion while unreconciled work remains.
Violation
Partial failure and cancellation produce explicit terminal states and cleanup.

Negative control

Generic concurrency in an unrelated subsystem does not count.

Permitted variation

Batch size, asyncio or promise scheduler, streaming reducer, and ordering policy.

Test obligation

Test one failure, cancellation, completion order, and concurrent side effects.

Evolution question

Did concurrency expand from tools to agents and preserve correlation?

PROMPT SKETCH
Dispatch independent invocations concurrently. Give every invocation a stable identity, stream results as they arrive, and do not declare the batch complete until each invocation has a result, a failure, or an explicit cancellation record.
CODE DESIGN / PYTHON
async def run_batch(invocations, runtime):
    pending = {inv.id: asyncio.create_task(runtime.invoke(inv)) for inv in invocations}
    results = {}
    for finished in asyncio.as_completed(pending.values()):
        result = await finished
        results[result.invocation_id] = result
        yield result
    missing = set(pending) - set(results)
    if missing:
        raise BatchIncomplete(sorted(missing))

Illustrative design sketch. Correlation by invocation id is the contract; concurrency alone is not. This example is a teaching aid, not implementation evidence or a conformance claim.

Join point
parallel_invocation_batch
Source locator
Barbaste et al., §6.2, p. 13 (Claude Code, “Streaming Loop with Concurrent Tool Batching”); shortened label
Lexical cue
(?i)\b(?:concurrent|parallel(?:ism)?|batch(?:ed|ing)?|Promise\.all|asyncio\.gather)\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.
Aliases
None
Canonical exemplar
OpenHands/software-agent-sdkopenhands-sdk/openhands/sdk/agent/parallel_executor.py:51Support: tests/sdk/agent/test_parallel_tool_span_context.py:1
Negative control
Generic concurrency in an unrelated subsystem does not count.

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

100.0% 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: 40 / 41
Canonical source anchorOpenHands/software-agent-sdk 5c524ad65d81openhands-sdk/openhands/sdk/agent/parallel_executor.py:51

Parallel batch tool executor with asyncio.gather.

Exploratory retrieval cue Regex / v0.1.0
(?i)\b(?:concurrent|parallel(?:ism)?|batch(?:ed|ing)?|Promise\.all|asyncio\.gather)\b

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