Catalog/P family/P03
Proposed specificationSource-located exemplarH1

Asynchronous state machine

Make waiting and resumption explicit.

JOIN POINTasynchronous_wait_and_resumeRECORD STATUSCandidate · v0.1.0
UML class view for Asynchronous state machine, showing participant roles, received calls, and analytical dependencies
FIG. P03 / UML CLASS VIEW
Object interaction diagram for Asynchronous state machine, showing role collaboration and a numbered message sequence
FIG. P03 / OBJECT INTERACTIONS
Context
A harness run may pause for external work or user input.
Trigger
An event requests suspension or arrives to resume a paused run.
Structure
Enumerated states, legal transitions, event identity, and resumption state.
Effect
A resumed run follows only the legal transition and preserves durable state.
Requires
State can be serialized or retained and incoming events can be identified.
Ensures
Accepted events move the machine to a defined state and duplicate events are handled.
Invariant
No transition crosses from a disallowed state or executes twice after replay.
Violation
Invalid, duplicate, or interrupted events leave a recoverable state or raise explicitly.

Negative control

An enum without transition enforcement is not sufficient.

Permitted variation

Transition dispatch, persistence backend, and recovery policy.

Test obligation

Test illegal transitions, duplicate events, interruption, and resume.

Evolution question

Did implicit control flow become an observable durable state machine?

PROMPT SKETCH
Treat a paused run as an explicit state, not a sleeping function. Persist the state token before waiting, accept only known events, and reject duplicate or illegal transitions with a typed error.
CODE DESIGN / PYTHON
TRANSITIONS = {
    "ready": {"start": "running"},
    "running": {"wait": "waiting", "finish": "done"},
    "waiting": {"resume": "running", "cancel": "cancelled"},
}

def apply(state, event, store):
    target = TRANSITIONS.get(state.status, {}).get(event.kind)
    if target is None:
        raise IllegalTransition(state.status, event.kind)
    next_state = state.with_status(target, event_id=event.id)
    store.save(next_state)
    return next_state

Illustrative design sketch. The durable record, not an in-memory coroutine, is the resumable unit. This example is a teaching aid, not implementation evidence or a conformance claim.

Join point
asynchronous_wait_and_resume
Source locator
Barbaste et al., §6.2, p. 14 (Codex, “Tokio Async State Machine”); generalized label
Lexical cue
(?i)\bstate[_-]?machine\b|\b(?:transition|transitions|legal_states)\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.
Aliases
None
Canonical exemplar
langchain-ai/langgraphlibs/langgraph/langgraph/graph/state.py:131Support: libs/langgraph/tests/test_subgraph_persistence_async.py:63
Negative control
An enum without transition enforcement is not sufficient.

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

94.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: 37 / 41
Canonical source anchorlangchain-ai/langgraph 5847733bcb18libs/langgraph/langgraph/graph/state.py:131

State graph with typed transitions and async execution.

Exploratory retrieval cue Regex / v0.1.0
(?i)\bstate[_-]?machine\b|\b(?:transition|transitions|legal_states)\b

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