livekit / agents

Build real-time multimodal AI applications 🤖🎙️📹
https://docs.livekit.io/agents
Apache License 2.0
4.07k stars 427 forks source link

OpenAI S2S Error: Your session hit the maximum duration of 15 minutes. #1073

Open ramikalai opened 1 week ago

ramikalai commented 1 week ago

I'm looking to run sessions in the 30+ minutes range and need to handle disconnects more gracefully, especially a timeout where it is inevitable at the 15 minute mark.

Would be great if the SDK could create a new connection, pass the messages across (assuming they fit in the context window) and restart the conversation seamlessly.

Here's the error log I received:

{"message": "OpenAI S2S error {'type': 'error', 'event_id': 'event_ASrZ7rjANnmB9VU5pR7YR', 'error': {'type': 'invalid_request_error', 'code': 'session_expired', 'message': 'Your session hit the maximum duration of 15 minutes.', 'param': None, 'event_id': None}}", "level": "ERROR", "name": "livekit.plugins.openai.realtime", "session_id": "sess_ASrKbnhOx1ypg69LBJTRo", "pid": 10, "job_id": "AJ_KdcwoYrsmwFA", "timestamp": "2024-11-12T20:14:13.590702+00:00"}
{"message": "Error in _recv_task\nTraceback (most recent call last):\n  File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/agents/utils/log.py\", line 16, in async_fn_logs\n    return await fn(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py\", line 835, in _recv_task\n    raise Exception(\"OpenAI S2S connection closed unexpectedly\")\nException: OpenAI S2S connection closed unexpectedly", "level": "ERROR", "name": "livekit.plugins.openai.realtime", "pid": 10, "job_id": "AJ_KdcwoYrsmwFA", "timestamp": "2024-11-12T20:14:13.600141+00:00"}
{"message": "Error in _main_task\nTraceback (most recent call last):\n  File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/agents/utils/log.py\", line 16, in async_fn_logs\n    return await fn(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py\", line 902, in _main_task\n    await asyncio.gather(*tasks)\n  File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/agents/utils/log.py\", line 16, in async_fn_logs\n    return await fn(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/appuser/.local/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py\", line 835, in _recv_task\n    raise Exception(\"OpenAI S2S connection closed unexpectedly\")\nException: OpenAI S2S connection closed unexpectedly", "level": "ERROR", "name": "livekit.plugins.openai.realtime", "pid": 10, "job_id": "AJ_KdcwoYrsmwFA", "timestamp": "2024-11-12T20:14:13.648497+00:00"}