Skip to content

read_wal_until

autogen.beta.network.client.handlers.read_wal_until async #

read_wal_until(client, envelope)

Return WAL slice up to (but excluding) envelope.

The current envelope is the prompt for this turn — it is fed to agent.ask separately rather than mixed into the projected history.

Source code in autogen/beta/network/client/handlers.py
async def read_wal_until(client: "AgentClient", envelope: Envelope) -> list[Envelope]:
    """Return WAL slice up to (but excluding) ``envelope``.

    The current envelope is the prompt for this turn — it is fed to
    ``agent.ask`` separately rather than mixed into the projected
    history.
    """
    wal = await client._hub_client.read_wal(envelope.session_id)
    history: list[Envelope] = []
    for env in wal:
        if env.envelope_id == envelope.envelope_id:
            break
        history.append(env)
    return history