> ## 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.

# instance.stop_listening

> Close the active gRPC stream opened by instance.listen and release the transport.

```python theme={null}
await sdk.instance.stop_listening()
```

<Note>
  Advanced: for real-time integrations. Pair this with [`instance.listen`](/sdk-reference/instance/listen) and call it during shutdown (or in a `finally` block) so the stream is closed cleanly.
</Note>

`stop_listening()` ends the bidirectional gRPC stream that `listen()` established, cancels the underlying transport, and clears the SDK's reference to it. After this call returns, `instance.is_listening` is `False` and any subsequent `instance.send_message` calls raise `ListeningNotActiveError`. Calling `stop_listening()` when no stream is active is a safe no-op.

### Parameters

This method takes no parameters.

### Returns

Returns `None`.

### Example

```python theme={null}
import asyncio
import uuid
from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

# conversation_id must be a valid UUID
conversation_id = str(uuid.uuid4())

listen_task = asyncio.create_task(sdk.instance.listen())
try:
    await sdk.instance.send_message(
        content="Hello",
        user_id="user_789",
        conversation_id=conversation_id,
    )
finally:
    await sdk.instance.stop_listening()
    listen_task.cancel()
```

### Raises

This method does not raise SDK errors under normal use. See [Error Codes](/sdk-reference/errors) for the full SDK exception hierarchy.

### See also

* [instance.listen](/sdk-reference/instance/listen): start the stream.
* [instance.send\_message](/sdk-reference/instance/send-message): push events while the stream is open.
* [shutdown](/sdk-reference/lifecycle/shutdown): full SDK teardown, which also tears down any active stream.
