Build the context.dependencies dict for the LLM turn.
CHANNEL_STATE_DEP resolves to the adapter's current State object (WorkflowState / DiscussionState / ...), passed in by the caller (folded once per turn). Tools that need channel-scoped state (e.g. context_vars on a workflow channel) inject it via ChannelStateInject. HUB_DEP resolves to the HubClient seam — the in-process-or-remote control surface — so an injected dependency works in both deployment modes.
Source code in autogen/beta/network/client/handlers.py
| def stamp_dependencies(
client: "AgentClient",
channel: Channel,
state: object | None,
) -> dict[object, object]:
"""Build the ``context.dependencies`` dict for the LLM turn.
``CHANNEL_STATE_DEP`` resolves to the adapter's current State
object (``WorkflowState`` / ``DiscussionState`` / ...), passed in by
the caller (folded once per turn). Tools that need channel-scoped
state (e.g. ``context_vars`` on a workflow channel) inject it via
``ChannelStateInject``. ``HUB_DEP`` resolves to the ``HubClient``
seam — the in-process-or-remote control surface — so an injected
dependency works in both deployment modes.
"""
return {
CHANNEL_DEP: channel,
AGENT_CLIENT_DEP: client,
HUB_DEP: client._hub_client,
CHANNEL_STATE_DEP: state,
}
|