Documentation Index
Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
Use this file to discover all available pages before exploring further.
Advanced — for real-time integrations. Most applications only need
fetch and memories.create. Use listen when you want Synap to proactively push anticipated context to your agent over a long-lived stream, instead of waiting for each fetch() round-trip.listen() opens a bidirectional gRPC stream between the SDK and the Synap platform. Once the stream is active, you can call instance.send_message to broadcast agent activity (user messages, tool calls, context requests), and the platform streams back anticipated context bundles. Each incoming bundle is automatically stored in the SDK’s anticipation cache so subsequent fetch() calls return instantly, and your on_context callback fires for any custom handling you need.
Parameters
Callback invoked when the underlying stream reconnects after a transient failure. Receives the attempt count as its only argument. Useful for logging or surfacing connection health in your UI.
Callback invoked when the stream disconnects. Receives the disconnect reason as a string.
Callback invoked each time the platform pushes an anticipated context bundle. The bundle dict contains keys like
items_by_type, retrieval_mode, and bundle_id. Bundles are also written to the SDK’s anticipation cache automatically — you only need this callback if you want to react to bundles directly (e.g., to prefetch UI state). Sync and async callables are both supported.Returns
ReturnsNone. The coroutine resolves once the stream is established; the stream itself stays open until you call instance.stop_listening.
Example
Raises
SDKNotInitializedError— wheninitialize()has not been called.AuthenticationError— when credentials are rejected by the platform.
See also
- instance.send_message — push agent activity over the active stream.
- instance.stop_listening — close the stream and release resources.
- fetch — request-response context retrieval (no streaming required).