Skip to content

strands.memory.extraction.coordinator

Background coordinator that saves conversation messages to memory stores.

The :class:ExtractionCoordinator buffers every message the agent produces and, when a store’s trigger fires, saves that store’s unsaved messages in the background. It keeps a per-store high-water mark so each message is delivered to a store at most once, serializes a single store’s saves through a per-store task chain, and backs off stores that fail repeatedly.

class ExtractionCoordinator()

Defined in: src/strands/memory/extraction/coordinator.py:39

Saves conversation messages to memory stores in the background.

Buffers every recorded message and, per store, tracks a high-water mark of the last seq saved so each message is delivered at most once. A single store’s saves are serialized through a per-store task chain; different stores save independently. Failures are logged and swallowed, with per-store backoff for repeatedly failing stores.

def __init__(stores: list[MemoryStore], default_model: Model) -> None

Defined in: src/strands/memory/extraction/coordinator.py:49

Initialize the coordinator.

Arguments:

  • stores - The extraction-configured stores this coordinator manages.
  • default_model - The agent’s model, passed to extractors that do not configure their own.
def record(message: Message) -> None

Defined in: src/strands/memory/extraction/coordinator.py:74

Add a message to the buffer.

def schedule(store: MemoryStore) -> None

Defined in: src/strands/memory/extraction/coordinator.py:79

Save this store’s unsaved messages in the background, non-blocking.

Dispatches the save and returns immediately. A no-op when the store is backed off and this request is not a probe.

def process(store: MemoryStore) -> asyncio.Task | None

Defined in: src/strands/memory/extraction/coordinator.py:100

Queue a save for this store behind its previous save.

Returns the task running the save, or None when the store is backed off and this request is not a probe.

async def flush() -> None

Defined in: src/strands/memory/extraction/coordinator.py:136

Save every store’s remaining buffered messages and wait for completion.

Bypasses backoff and also waits out saves that start while waiting. Never raises.