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.
ExtractionCoordinator
Section titled “ExtractionCoordinator”class ExtractionCoordinator()Defined in: src/strands/memory/extraction/coordinator.py:54
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.
__init__
Section titled “__init__”def __init__(bindings: list[_ExtractionBinding], default_model: Model) -> NoneDefined in: src/strands/memory/extraction/coordinator.py:64
Initialize the coordinator.
Arguments:
bindings- The extraction-configured stores this coordinator manages, each paired with its fully-resolved config.default_model- The agent’s model, passed to extractors that do not configure their own.
record
Section titled “record”def record(message: Message) -> NoneDefined in: src/strands/memory/extraction/coordinator.py:94
Add a message to the buffer.
schedule
Section titled “schedule”def schedule(store: MemoryStore) -> NoneDefined in: src/strands/memory/extraction/coordinator.py:99
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.
process
Section titled “process”def process(store: MemoryStore) -> asyncio.Task | NoneDefined in: src/strands/memory/extraction/coordinator.py:120
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() -> NoneDefined in: src/strands/memory/extraction/coordinator.py:156
Save every store’s remaining buffered messages and wait for completion.
Bypasses backoff and also waits out saves that start while waiting. Never raises.