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 and lists its network tools.

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} "
        f"(agent_id: {self._client.agent_id}).\n"
        "Network tools: say, delegate, peers, channels, tasks, context."
    )
    return [prefix, *prompts], events