Choose the right pattern
AsyncMemory.add() avoids blocking Python’s event loop while waiting for admission. It does not mean extraction has finished, and an untracked asyncio.create_task() is not reliable background delivery if the request/process exits. Use your application’s existing durable job mechanism or await admission after persisting the turn. Save the idempotency key and authorized payload so retries reuse the same operation.
Ordinary capture example
Run this function from your application’s existing background worker after persisting a completed conversation turn. The caller supplies a stable owner, conversation, turn ID and request key from its own saved record.A follow-up arrives during processing
Retrieve again and inspect the returned signals. Ifmemory_visibility.state is processing, return a message such as:
Your memory update is still processing. Please try again shortly.For
unavailable, show an unavailable message and any safe review controls. Do not block the HTTP request for a two-minute polling loop, call the model with withheld facts, or substitute an earlier cached client copy. Offer another read later or an explicit retry action; a completed job can still be followed by publication/processing visibility.
If the response is empty or passthrough without a hold, your application can answer unrelated questions without memory. It should not invent an answer to a question that specifically asks for the user’s current stored state.