Skip to content

default_build_round_envelope

autogen.beta.network.adapters.base.default_build_round_envelope #

default_build_round_envelope(metadata, sender_id, reply, events, state, hub)

Default build_round_envelope: emit EV_TEXT(body) or None.

Adapters that don't have a richer round-end shape delegate to this helper from their build_round_envelope.

Source code in autogen/beta/network/adapters/base.py
def default_build_round_envelope(
    metadata: SessionMetadata,
    sender_id: str,
    reply: "AgentReply",
    events: "list[BaseEvent]",
    state: AdapterState,
    hub: "Hub",
) -> Envelope | None:
    """Default ``build_round_envelope``: emit ``EV_TEXT(body)`` or
    ``None``.

    Adapters that don't have a richer round-end shape delegate to
    this helper from their ``build_round_envelope``.
    """
    body = reply.body or ""
    if not body:
        return None
    return Envelope(
        session_id=metadata.session_id,
        sender_id=sender_id,
        audience=None,
        event_type=EV_TEXT,
        event_data={"text": body},
    )