Skip to content

build_input_response_message

autogen.beta.a2a.mappers.messages.build_input_response_message #

build_input_response_message(text, *, task_id, context_id=None, message_id=None, context_update=None, extra_metadata=None)

Build a continuation Message carrying a HITL response back.

Sent after the server transitioned the task to TASK_STATE_INPUT_REQUIRED: we wrap the user's reply as a single text Part and reuse the existing task_id so the server can resume the same task.

Source code in autogen/beta/a2a/mappers/messages.py
def build_input_response_message(
    text: str,
    *,
    task_id: str,
    context_id: str | None = None,
    message_id: str | None = None,
    context_update: Mapping[str, Any] | None = None,
    extra_metadata: Mapping[str, Any] | None = None,
) -> Message:
    """Build a continuation ``Message`` carrying a HITL response back.

    Sent after the server transitioned the task to
    ``TASK_STATE_INPUT_REQUIRED``: we wrap the user's reply as a single
    text Part and reuse the existing ``task_id`` so the server can
    resume the same task.
    """
    return _build_message(
        [Part(text=text)],
        role=Role.ROLE_USER,
        task_id=task_id,
        context_id=context_id,
        message_id=message_id,
        advertise_extension=False,
        context_update=context_update,
        extra_metadata=extra_metadata,
    )