parse_resume_command(
items: Sequence[Any],
pending: Sequence[Interrupt]
) -> tuple[Command | None, frozenset[str]]Build a resume :class:Command from request input items, if present.
Two input shapes are accepted, both keyed by interrupt.id:
FunctionCallOutputItemParam matched by call_id. Its
output field is decoded — a JSON object with any of
{"resume", "update", "goto"} populates the :class:Command;
anything else (string, malformed JSON, list of content parts) is
treated as the raw resume value.MCPApprovalResponse matched by approval_request_id. For a
recognized LangChain HumanInTheLoopMiddleware request, its boolean
choice becomes one ordered decision per action. Otherwise,
approve=True retains the original interrupt-value echo behavior and
approve=False is surfaced by :func:validate_approval_responses.
Recognition uses the complete action_requests / review_configs
structure, which is reserved for this fast path. Use
function_call_output to preserve an identically shaped custom value.Conflict resolution: when both shapes target the same interrupt id
in one request, the function_call_output wins (richer payload)
and a warning is logged. This is a deliberate, deterministic
departure from Agent Framework's order-dependent last-write-wins.
Callers must run :func:validate_approval_responses first; it rejects
conflicting MCP approval responses before this function builds a command.
Resume shape: with a single pending interrupt the resume value is
passed through as-is (Command(resume=value)). With parallel
pending interrupts LangGraph requires an id-keyed resume map — a
bare value raises RuntimeError: When there are multiple pending interrupts, you must specify the interrupt id when resuming. — so
every matched item that explicitly carries a resume value is folded
into Command(resume={id: value}). Answering only some of the pending
interrupts is allowed; the unanswered ones stay paused.
Resolved input items from the request.
Pending interrupts on the graph's checkpointed state.