MemoryStore for long-term memory, hooks for short-term context and real-time anticipation, and @tool functions for explicit control.
Requires Python 3.11+ and
strands-agents>=1.48.Overview
Four surfaces, each mapped onto a native Strands extension point. Adopt only the ones you need.
All four take an already-constructed
MaximemSynapSDK — your app owns the SDK, its credentials, and (for streaming) its connection lifecycle.
Setup
Basic integration
Register Synap as a StrandsMemoryStore; MemoryManager then handles recall, automatic prompt injection, and extraction.
Core concepts
SynapMemoryStore
A structural implementation of Strands’MemoryStore protocol.
searchreads Synap’s long-term layer viasdk.fetchand returns structuredMemoryEntryobjects (facts, preferences, episodes, emotions, temporal events). Reads degrade gracefully — a Synap blip returns[]rather than crashing recall.add_messagesis the primary write sink.MemoryManagerhands it conversation batches; it ingests the assembled transcript viasdk.memories.create(server-side extraction, no extra model call) under a stabledocument_id, so repeated extraction submissions update one document instead of duplicating.addingests a single fact viasdk.memories.create.
search reads — which is why writes deliberately go through memories.create, not conversation recording.
SynapShortTermHook
Strands’system_prompt is a static string, so short-term context is injected via a hook on BeforeInvocationEvent (the one before-event whose messages are writable). It folds Synap’s working-memory summary into the current turn’s first user message.
conversation_id is required and explicit. Empty context is a no-op; SDK failures are swallowed by default (on_error="fallback"), or set on_error="raise" for strict environments.
Strands exposes no ephemeral per-call injection hook to user code, so injected context becomes part of the conversation the agent persists. The hook folds one context block into each turn’s user message (with an idempotency guard) rather than adding throwaway turns.
create_synap_tools
For agents that want explicit control instead ofMemoryManager. Returns search_memory and store_memory as Strands @tool functions.
SynapStreamHook
Makes the agent a participant in Synap’s real-time anticipation pipeline by feeding its turns and tool-call intent onto the gRPC Listen stream. See Advanced patterns.Complete example: multi-user support agent
Advanced patterns
Real-time anticipation with the Listen stream
SynapStreamHook feeds the agent’s turns and tool-call intent onto Synap’s gRPC Listen stream so the Anticipation Agent can pre-fetch context before the agent asks. Your app owns the stream lifecycle; the hook only feeds an already-open stream and no-ops when none is active.
Not SessionManager
This integration does not implement Strands’ SessionManager / snapshot storage. That persists opaque conversation snapshots for replay — a different concern from Synap’s semantic memory. Use FileSessionManager / S3SessionManager for durable sessions and a SynapMemoryStore for memory; they compose.
Going further
- Error policy. Reads (
search,search_memory) degrade and return empty; writes (add,add_messages,store_memory) raiseSynapIntegrationError; stream sends log and never raise. - Scoping.
user_idandcustomer_idflow straight to Synap; per-user isolation and B2C/B2B scope are derived server-side from the ids you pass.
Next steps
SDK: Ingestion
How
memories.create extraction and conversation recording differ.Integrations overview
Every framework Synap plugs into.