Skip to content

WorkingMemoryPolicy

autogen.beta.policies.working_memory.WorkingMemoryPolicy #

Injects /memory/working.md from the knowledge store.

Working memory is the actor's persistent state -- updated by AggregateStrategy between conversations. This policy injects it as system prompt context so the actor has continuity.

name class-attribute instance-attribute #

name = 'working_memory'

apply async #

apply(prompts, events, context)
Source code in autogen/beta/policies/working_memory.py
async def apply(
    self,
    prompts: list[str],
    events: list[BaseEvent],
    context: Context,
) -> tuple[list[str], list[BaseEvent]]:
    store = context.dependencies.get(KnowledgeStore)
    if not store:
        return prompts, events

    content = await store.read(WORKING_MEMORY_PATH)
    if content:
        prompts = prompts + [f"## Working Memory\n\n{content}"]

    return prompts, events