You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible for an agent to get stuck in an infinite loop while waiting for run_agent to complete using OpenAI Assistants.
When this happens the output loops like this indefinitely.
INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN/steps?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polling run status: run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polled run status: incomplete, run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN/steps?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polling run status: run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polled run status: incomplete, run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW
Some traceback that may be helpful...
Traceback (most recent call last): File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File ".../app.py", line 672, in main results = await run_agent( ^^^^^^^^^^^^^^^^ File ".../app.py", line 544, in run_agent async for content in chat.invoke(): File ".../semantic_kernel/agents/group_chat/agent_group_chat.py", line 144, in invoke async for message in super().invoke_agent(selected_agent): File ".../semantic_kernel/agents/group_chat/agent_chat.py", line 144, in invoke_agent async for is_visible, message in channel.invoke(agent): File ".../semantic_kernel/agents/channels/open_ai_assistant_channel.py", line 64, in invoke async for is_visible, message in agent._invoke_internal(thread_id=self.thread_id): File ".../semantic_kernel/agents/open_ai/open_ai_assistant_base.py", line 767, in _invoke_internal steps_response = await self.client.beta.threads.runs.steps.list(run_id=run.id, thread_id=thread_id)
Expected behavior
An incomplete run should fail after a period of time, not continue to run indefinitely.
Platform
OS: Ubuntu in WSL2 on Windows 11
IDE: VS Code
Language: Python
Source: pip package version 1.11.0, main branch of repository
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Bug: Python: Infinite Loop in OpenAI Assistants Agent Run
Python: Bug: Python: Infinite Loop in OpenAI Assistants Agent Run
Oct 21, 2024
It is possible for an agent to get stuck in an infinite loop while waiting for
run_agent
to complete using OpenAI Assistants.When this happens the output loops like this indefinitely.
INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN/steps?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polling run status: run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polled run status: incomplete, run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN/steps?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polling run status: run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW INFO:httpx:HTTP Request: GET https://.../openai/threads/thread_qHmca1g1DbVJ9pptM8k3a0hW/runs/run_p8Bv3O4ffO68aGGgDA23QzmN?api-version=2024-09-01-preview "HTTP/1.1 200 OK" INFO:semantic_kernel.agents.open_ai.open_ai_assistant_base:Polled run status: incomplete, run_p8Bv3O4ffO68aGGgDA23QzmN, threadId: thread_qHmca1g1DbVJ9pptM8k3a0hW
Some traceback that may be helpful...
Traceback (most recent call last): File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File ".../app.py", line 672, in main results = await run_agent( ^^^^^^^^^^^^^^^^ File ".../app.py", line 544, in run_agent async for content in chat.invoke(): File ".../semantic_kernel/agents/group_chat/agent_group_chat.py", line 144, in invoke async for message in super().invoke_agent(selected_agent): File ".../semantic_kernel/agents/group_chat/agent_chat.py", line 144, in invoke_agent async for is_visible, message in channel.invoke(agent): File ".../semantic_kernel/agents/channels/open_ai_assistant_channel.py", line 64, in invoke async for is_visible, message in agent._invoke_internal(thread_id=self.thread_id): File ".../semantic_kernel/agents/open_ai/open_ai_assistant_base.py", line 767, in _invoke_internal steps_response = await self.client.beta.threads.runs.steps.list(run_id=run.id, thread_id=thread_id)
Expected behavior
An incomplete run should fail after a period of time, not continue to run indefinitely.
Platform
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: