Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Bug: Python: Infinite Loop in OpenAI Assistants Agent Run #9364

Open
corytomlinson opened this issue Oct 21, 2024 · 0 comments
Open
Labels
bug Something isn't working python Pull requests for the Python Semantic Kernel triage

Comments

@corytomlinson
Copy link

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.

@corytomlinson corytomlinson added the bug Something isn't working label Oct 21, 2024
@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel triage labels Oct 21, 2024
@github-actions github-actions bot 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Pull requests for the Python Semantic Kernel triage
Projects
None yet
Development

No branches or pull requests

2 participants