Skip to content

symfonic.agent.facade_continuation

facade_continuation

Continuation and child-delegation invocation helpers for :class:Agent.

AgentContinuationMixin

Keep trusted recovery and child lineage out of the ordinary facade.

continue_recovered async

continue_recovered(continuation: RecoveredContinuation) -> AgentResult[Any]

Run one host-recovered turn with a new, kernel-owned run identity.

RecoveredContinuation is trusted composition metadata after the host has authenticated and claimed its pause token; this entry accepts no scope or caller-selected new run ID.

Source code in src/symfonic/agent/facade_continuation.py
async def continue_recovered(
    self, continuation: RecoveredContinuation
) -> AgentResult[Any]:
    """Run one host-recovered turn with a new, kernel-owned run identity.

    ``RecoveredContinuation`` is trusted composition metadata after the
    host has authenticated and claimed its pause token; this entry accepts
    no scope or caller-selected new run ID.
    """
    if not isinstance(continuation, RecoveredContinuation):
        raise TypeError("continue_recovered needs a RecoveredContinuation")
    _refuse_receipt_continuation(self)
    _refuse_fenced_recovery(self)
    request = _recovered_turn_for(continuation)
    return await dispatch(self._kernel, self._prepare, request, None,
                          self._composed_capabilities)

continue_recovered_typed

continue_recovered_typed(continuation: RecoveredContinuation, *, prepared_plan: InvocationPlan | None = None, event_guard: Any = None) -> AsyncIterator[Any]

Project raw recovered events onto the existing typed vocabulary.

The projection owns source closure and emits a completion only when the kernel reports done. A second pause therefore stays a pause. prepared_plan and event_guard are trusted host composition hooks: use an already-admitted plan and observe raw events before they are projected. These hooks do not authenticate or claim a pause token.

Source code in src/symfonic/agent/facade_continuation.py
def continue_recovered_typed(
    self, continuation: RecoveredContinuation, *,
    prepared_plan: InvocationPlan | None = None, event_guard: Any = None,
) -> AsyncIterator[Any]:
    """Project raw recovered events onto the existing typed vocabulary.

    The projection owns source closure and emits a completion only when the
    kernel reports ``done``. A second pause therefore stays a pause.
    ``prepared_plan`` and ``event_guard`` are trusted host composition
    hooks: use an already-admitted plan and observe raw events before they
    are projected. These hooks do not authenticate or claim a pause token.
    """
    if not isinstance(continuation, RecoveredContinuation):
        raise TypeError("continue_recovered_typed needs a RecoveredContinuation")
    from symfonic.agent.typed_projection import typed_stream

    source = self._continue_recovered_stream(
        continuation, prepared_plan=prepared_plan, event_guard=event_guard,
    )
    return typed_stream(native_pause_events(source))