Skip to content

NetworkContextPolicy

autogen.beta.network.client.plugin.NetworkContextPolicy #

NetworkContextPolicy(client)

Assembly policy: prepends a network-aware prefix to every LLM call.

Names the agent. The per-turn tool list is dynamic (identity-level set + adapter-provided set merged by the handler) so the prefix doesn't enumerate tools — the LLM sees them in its tools array.

Source code in autogen/beta/network/client/plugin.py
def __init__(self, client: "AgentClient") -> None:
    # __init__ stores params; no side effects.
    self._client = client

name class-attribute instance-attribute #

name = 'network_context'

apply async #

apply(prompts, events, context)
Source code in autogen/beta/network/client/plugin.py
async def apply(
    self,
    prompts: list[str],
    events: list[BaseEvent],
    context: "Context",
) -> tuple[list[str], list[BaseEvent]]:
    prefix = f"You are {self._client.passport.name} (agent_id: {self._client.agent_id})."
    return [prefix, *prompts], events