From 9c68f99d1f0608735fd9a4b359920779b05543a2 Mon Sep 17 00:00:00 2001 From: Adrian Czerwiec Date: Thu, 16 Oct 2025 16:15:33 +0200 Subject: [PATCH 1/2] Add disconnect method to agent session --- fishjam/agent/agent.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fishjam/agent/agent.py b/fishjam/agent/agent.py index f752568..8565a3e 100644 --- a/fishjam/agent/agent.py +++ b/fishjam/agent/agent.py @@ -151,6 +151,9 @@ async def add_track(self, options: OutgoingAudioTrackOptions): async def _send(self, message: AgentRequest): await self._ws.send(bytes(message), text=False) + async def disconnect(self): + await self._ws.close() + class Agent: """ From 4ea7ff1eba72a43f74e17215cbe6374dfcfcc4f9 Mon Sep 17 00:00:00 2001 From: Adrian Czerwiec Date: Fri, 17 Oct 2025 16:27:25 +0200 Subject: [PATCH 2/2] add docstring --- fishjam/agent/agent.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fishjam/agent/agent.py b/fishjam/agent/agent.py index 8565a3e..80031e1 100644 --- a/fishjam/agent/agent.py +++ b/fishjam/agent/agent.py @@ -152,6 +152,10 @@ async def _send(self, message: AgentRequest): await self._ws.send(bytes(message), text=False) async def disconnect(self): + """ + Ends the agent session by closing the websocket connection. + Useful when you don't use the context manager to obtain the session. + """ await self._ws.close()