AgentClient
autogen.beta.network.client.agent_client.AgentClient #
Tenant-side handle for one (Agent, identity, hub) registration.
Source code in autogen/beta/network/client/agent_client.py
current_handling_depth property #
Depth of the envelope this agent is currently handling.
Returns 0 when no handler is on the stack (i.e. the agent initiated the call from outside any inbound delivery). Used by delegate to stamp Envelope.depth = current + 1.
receive async #
Hub delivery → fan out to inbox + (suppressible) handler.
Source code in autogen/beta/network/client/agent_client.py
on_envelope #
Override the default notify handler with a custom callback.
Calling with the default handler restores it: pass self._run_default_handler (or simply construct without attach_default_handler=False).
Source code in autogen/beta/network/client/agent_client.py
disconnect async #
resume_pending_turns async #
Re-fire the notify handler against every turn the protocol currently expects from this agent.
Asks the hub for :class:PendingTurn entries (:meth:Hub.pending_turns_for), fetches each turn's triggering envelope from the WAL, and feeds it back through :meth:receive. Returns the number of turns re-fired. Entries without a triggering envelope are skipped — e.g. a freshly opened channel where the creator has nothing to react to yet.
Idempotent under at-least-once delivery: if a prior reply already landed, the agent's handler can short-circuit via :meth:Hub.find_envelope_by_causation so the same logical turn is not posted twice.
Source code in autogen/beta/network/client/agent_client.py
open async #
Open a channel via the hub and return its :class:Channel handle.
target accepts peer names or agent_ids; resolution goes through the bound :class:HubClient.
Source code in autogen/beta/network/client/agent_client.py
ensure_channel_inbox #
Create (or fetch) the per-channel inbox queue.
Callers that send first and then wait_for_channel_event MUST call this BEFORE the send. Otherwise a fast reply (e.g. via LocalLink where dispatch happens on the same event-loop tick) can be delivered to receive before the wait creates the inbox — the envelope would then be dropped silently.
Idempotent: returns the existing queue if one is already bound.
Source code in autogen/beta/network/client/agent_client.py
discard_channel_inbox #
Drop the per-channel inbox queue.
Callers should invoke this after they've finished waiting on a channel so the per-client memory footprint doesn't grow with every consulted channel.
Source code in autogen/beta/network/client/agent_client.py
wait_for_channel_event async #
Block until an inbound envelope on channel_id matches.
Used by delegate to await the consulting respondent's reply. The inbox is created on demand and shared across waits; callers should not hold multiple concurrent waits on the same channel.
Raises asyncio.TimeoutError on timeout.
Source code in autogen/beta/network/client/agent_client.py
send_envelope async #
Post an envelope through the hub. Returns the stamped envelope_id.
Source code in autogen/beta/network/client/agent_client.py
set_resume async #
Source code in autogen/beta/network/client/agent_client.py
add_example async #
Append a ResumeExample to this agent's resume.
Fetches the latest resume from the hub first so concurrent set_resume / record_observation updates don't get clobbered.