HumanClient
autogen.beta.network.client.human_client.HumanClient #
Per-registration handle for a non-LLM participant.
Satisfies the NetworkClient Protocol. Constructed by HubClient.register_human(...); not intended for direct instantiation.
Source code in autogen/beta/network/client/human_client.py
receive async #
Hub delivery → fan out to callbacks + pull queue.
Channel invites are auto-acked by default — without this, every channel an agent opens to a human would time out at the hub-side invite_ack_timeout. Embedders that want to gate channel joins (e.g. show an "accept invite?" UI prompt) pass auto_ack_invites=False to register_human and emit the ack themselves.
Push callbacks run sequentially in registration order. Each callback's exception is logged but does not abort dispatch to siblings or to the pull queue — the framework treats the UI layer as best-effort.
Source code in autogen/beta/network/client/human_client.py
disconnect async #
Stop accepting deliveries and wake any blocked consumers. Idempotent.
Pull-mode consumers (next_envelope / envelopes / wait_for_channel_event) park on Queue.get(). Without a wakeup they would block forever after disconnect — this method broadcasts an end-of-stream sentinel into every queue so each waiter unblocks and either raises (next_envelope) or breaks (envelopes).
Source code in autogen/beta/network/client/human_client.py
receive_chunk async #
Streaming chunks are LLM-output flow control; humans see the final envelope. No-op for the V1 HumanClient surface.
Embedders that want token-level streaming display can subclass and forward delta to their UI; the framework neither requires nor blocks that.
Source code in autogen/beta/network/client/human_client.py
on_envelope #
Register a coroutine fired per inbound envelope.
Multiple callbacks compose in registration order. Exceptions raised by a callback are logged at ERROR and never propagate to the hub's dispatch path.
Source code in autogen/beta/network/client/human_client.py
remove_envelope_callback #
Detach a previously-registered callback. No-op if absent.
next_envelope async #
Block until the next matching envelope arrives.
predicate=None returns the very next envelope. timeout in seconds; raises asyncio.TimeoutError if exceeded. Envelopes that don't match the predicate are discarded — pass them via on_envelope if you want both behaviors at once.
Raises RuntimeError if the client is (or becomes) disconnected.
Source code in autogen/beta/network/client/human_client.py
envelopes async #
Stream every inbound envelope until disconnect.
Yields envelopes in arrival order. The iterator terminates when disconnect() is called (consumers blocked on get() are woken via the disconnect sentinel).
Source code in autogen/beta/network/client/human_client.py
send async #
Post an EV_TEXT envelope into channel_id. Returns envelope_id.
Convenience wrapper for the common case. For non-text events or adapter-shaped envelopes (e.g. workflow EV_PACKET), build the Envelope directly and call post_envelope.
Source code in autogen/beta/network/client/human_client.py
post_envelope async #
Post an arbitrary envelope through the hub.
Escape hatch for adapter-shaped envelopes (workflow EV_PACKET seeds, etc.) constructed via Layer-2 envelope helpers. envelope.sender_id is stamped if blank.
Source code in autogen/beta/network/client/human_client.py
open async #
Open a channel as the initiator and return a Channel handle.
target accepts peer names or agent_ids; resolution goes through the bound HubClient.
Source code in autogen/beta/network/client/human_client.py
close_channel async #
Close a channel this participant is in.
Source code in autogen/beta/network/client/human_client.py
send_envelope async #
ensure_channel_inbox #
Public alias for the per-channel inbox helper.
Channel doesn't currently call this on humans, but the method exists so any future helper that does inherit the AgentClient pattern (ensure → send → wait) works uniformly.
Source code in autogen/beta/network/client/human_client.py
wait_for_channel_event async #
Block until a channel-scoped envelope matches.
Symmetric with AgentClient.wait_for_channel_event; useful for UIs that want to await a specific reply (e.g. "did the consulted agent finish?") without setting up a callback.