Closed ha-zhcool closed 2 months ago
Hey, I have also been having this issue lately. This can happen for 2 reasons:
I fixed the second reason and will push the fix in the next release.
In the meantime, try increasing the timeout with:
import openai
import httpx
from agency_swarm.util.oai import set_openai_client
client = openai.OpenAI(api_key=<YOUR_OPENAI_KEY>,
timeout=httpx.Timeout(60.0, read=10.0, write=15.0, connect=5.0),
max_retries=5)
set_openai_client(client)
To fix the second, you can also add in shared instructions "Only send messages to 1 agent at a time."
Thanks for your reply. In which file should I increase the timeout? the agency file or for each agent?
Please upgrade to the latest release. I played with these timeouts and set default values that completely eliminate these issues.
Please upgrade to the latest release. I played with these timeouts and set default values that completely eliminate these issues.
I will now proceed to create these tools within the system. Traceback (most recent call last): File "C:\Python312\Lib\site-packages\httpcore_exceptions.py", line 10, in map_exceptions yield File "C:\Python312\Lib\site-packages\httpcore_backends\sync.py", line 126, in read return self._sock.recv(max_bytes) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\ssl.py", line 1233, in recv return self.read(buflen) ^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\ssl.py", line 1106, in read return self._sslobj.read(len) ^^^^^^^^^^^^^^^^^^^^^^ TimeoutError: The read operation timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Python312\Lib\site-packages\httpx_transports\default.py", line 66, in map_httpcore_exceptions yield File "C:\Python312\Lib\site-packages\httpx_transports\default.py", line 110, in iter for part in self._httpcore_stream: File "C:\Python312\Lib\site-packages\httpcore_sync\connection_pool.py", line 361, in iter for part in self._stream: File "C:\Python312\Lib\site-packages\httpcore_sync\http11.py", line 337, in iter raise exc File "C:\Python312\Lib\site-packages\httpcore_sync\http11.py", line 329, in iter for chunk in self._connection._receive_response_body(**kwargs): File "C:\Python312\Lib\site-packages\httpcore_sync\http11.py", line 198, in _receive_response_body event = self._receive_event(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\httpcore_sync\http11.py", line 212, in _receive_event data = self._network_stream.read( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\httpcore_backends\sync.py", line 124, in read with map_exceptions(exc_map): File "C:\Python312\Lib\contextlib.py", line 158, in exit self.gen.throw(value) File "C:\Python312\Lib\site-packages\httpcore_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ReadTimeout: The read operation timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "
I'm constantly facing the same error after few request and the agency script stops working and the interface stops responding. I should always restart the agency and start over again. Could you please help fixing this issue