Skip to content

stamp_dependencies

autogen.beta.network.client.handlers.stamp_dependencies #

stamp_dependencies(client, session)

Build the context.dependencies dict for the LLM turn.

SESSION_STATE_DEP resolves to the adapter's current State object (WorkflowState / DiscussionState / ...). Tools that need to read session-scoped state (e.g. context_vars on a workflow session) inject it via SessionStateInject.

Source code in autogen/beta/network/client/handlers.py
def stamp_dependencies(
    client: "AgentClient",
    session: Session,
) -> dict[object, object]:
    """Build the ``context.dependencies`` dict for the LLM turn.

    ``SESSION_STATE_DEP`` resolves to the adapter's current State
    object (``WorkflowState`` / ``DiscussionState`` / ...). Tools that
    need to read session-scoped state (e.g. ``context_vars`` on a
    workflow session) inject it via ``SessionStateInject``.
    """
    return {
        SESSION_DEP: session,
        AGENT_CLIENT_DEP: client,
        HUB_DEP: client._hub,
        SESSION_STATE_DEP: client._hub._adapter_states.get(session.session_id),
    }