Skip to main content

maximem-synap-strands-agents

Maximem Synap memory for Strands Agents. Four surfaces, each mapped onto a native Strands extension point.

pip install maximem-synap-strands-agents
Surface Class / function Strands extension point What it does
Long-term memory SynapMemoryStore MemoryStore → MemoryManager Synap as the agent's memory backend: recall, prompt injection, server-side extraction
Short-term context SynapShortTermHook HookProvider (BeforeInvocationEvent) Injects Synap's working-memory summary before each turn
Explicit tools create_synap_tools @tool search_memory / store_memory for agents not using MemoryManager
Anticipation feed SynapStreamHook HookProvider (message + tool-call events) Feeds turns and tool intent onto Synap's gRPC Listen stream

All four take an already-constructed MaximemSynapSDK — the app owns the SDK, its credentials, and (for streaming) its connection lifecycle.

Long-term memory — SynapMemoryStore

Register Synap as a Strands MemoryStore; MemoryManager then handles recall, automatic prompt injection, and extraction.

from strands import Agent
from strands.memory import MemoryManager
from maximem_synap import MaximemSynapSDK
from synap_strands_agents import SynapMemoryStore

sdk = MaximemSynapSDK(api_key="sk-...")
store = SynapMemoryStore(sdk, user_id="alice", customer_id="acme")

agent = Agent(memory_manager=MemoryManager(stores=[store]))

search reads Synap's long-term layer (sdk.fetch) and returns structured MemoryEntry objects. Writes go through sdk.memories.create: add for single facts, and add_messages for conversation batches — the latter ingests the assembled transcript under a stable document_id so MemoryManager's periodic extraction updates one document instead of duplicating. (Recorded conversation messages, by contrast, feed only short-term compaction — so they are deliberately not the write path here.)

Short-term context — SynapShortTermHook

Strands' system_prompt is static, so working-memory context is injected via a hook. It folds Synap's short-term summary into the current turn's first user message.

from synap_strands_agents import SynapShortTermHook

agent = Agent(
    system_prompt="You are a support agent.",
    hooks=[SynapShortTermHook(sdk, conversation_id="conv_abc")],
)

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.

Note. Strands exposes no ephemeral per-call injection hook to user code, so the 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.

Explicit tools — create_synap_tools

For agents that want direct control instead of MemoryManager:

from synap_strands_agents import create_synap_tools

agent = Agent(
    system_prompt="You are a helpful assistant.",
    tools=create_synap_tools(sdk, user_id="alice", customer_id="acme"),
)

Adds search_memory(query) and store_memory(content).

Anticipation feed — 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. The app owns the stream lifecycle. Without an open stream the hook still writes the user and assistant turns, over REST (conversation.record_message) under its conversation_id, so Synap keeps the conversation for compaction and history search; tool events are stream-only. A turn is never written both ways.

from synap_strands_agents import SynapStreamHook

await sdk.instance.listen()                      # app opens the stream
hook = SynapStreamHook(sdk, conversation_id="conv_abc", user_id="alice")
agent = Agent(hooks=[hook, SynapShortTermHook(sdk, conversation_id="conv_abc")])
# ... run the agent ...
await sdk.instance.stop_listening()              # app closes it on shutdown

Run on one event loop. The stream's background tasks bind to the loop listen() ran on; construct the SDK, call listen(), and run the agent on that same asyncio loop. Beyond the turns, the hook feeds real-time signal — it does not store long-term memories (that's SynapMemoryStore / the tools).

Error policy

  • Reads (search, search_memory) degrade gracefully — log at ERROR, return empty.
  • Writes (add, add_messages, store_memory) raise SynapIntegrationError.
  • Stream sends log and never raise — they run inside Strands' event loop and must not abort a turn.

Not in scope: SessionManager

This integration does not implement Strands' SessionManager / snapshot storage. That persists opaque conversation snapshots for replay, which is a different concern from Synap's semantic memory. Use FileSessionManager / S3SessionManager for durable sessions and a SynapMemoryStore for memory — they compose.

License

Apache-2.0

Metadata

Release files for maximem-synap-strands-agents 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maximem-synap-strands-agents 0.1.2
File Size Uploaded Provenance Actions
maximem_synap_strands_agents-0.1.2.tar.gz 17.0 kB Without provenance Details for maximem_synap_strands_agents-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maximem-synap-strands-agents 0.1.2
File Interpreter ABI Platform Actions
maximem_synap_strands_agents-0.1.2-py3-none-any.whl Python 3 none any Details for maximem_synap_strands_agents-0.1.2-py3-none-any.whl

Total release size: 32.7 kB

Release files / maximem_synap_strands_agents-0.1.2.tar.gz

Download URL maximem_synap_strands_agents-0.1.2.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2c0fb2dd053866c28ed0cd83b5343f6494db820552c40870f9aa0b6869c4f792
BLAKE2b-256 checksum
How to use checksums
3fa8408f3e46368769804db677f07d6f74868bb200a664a1c25221eef05b85ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / maximem_synap_strands_agents-0.1.2-py3-none-any.whl

Download URL maximem_synap_strands_agents-0.1.2-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9b0430ffed7044d0fe870bdf4ffddcae34842e616eb33ae2c850ea2f809cbf5
BLAKE2b-256 checksum
How to use checksums
2f5e7809b6411af75e76530bc5b0aae32f6466879c74b5c911fb6e83a72e699b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for maximem-synap-strands-agents 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page