-
Notifications
You must be signed in to change notification settings - Fork 481
Open
Labels
Description
Tracer Version(s)
4.4.0
Python Version(s)
Python 3.13.2
Pip Version(s)
pip 26.0
Bug Report
We have a FastAPI application that we run with gunicorn and use ddtrace for tracing. In openapi-agents >= 0.8.0, they removed agents.run.AgentRunner._run_single_run, which ddtrace tries to patch in ddtrace/contrib/internal/openai_agents/patch.py, leading to the following traceback:
Traceback (most recent call last):
File "/home/teamai/.venv/lib/python3.13/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
worker.init_process()
~~~~~~~~~~~~~~~~~~~^^
File "/home/teamai/.venv/lib/python3.13/site-packages/gunicorn/workers/base.py", line 135, in init_process
self.load_wsgi()
~~~~~~~~~~~~~~^^
File "/home/teamai/.venv/lib/python3.13/site-packages/gunicorn/workers/base.py", line 147, in load_wsgi
self.wsgi = self.app.wsgi()
~~~~~~~~~~~~~^^
File "/home/teamai/.venv/lib/python3.13/site-packages/gunicorn/app/base.py", line 66, in wsgi
self.callable = self.load()
~~~~~~~~~^^
File "/home/teamai/.venv/lib/python3.13/site-packages/gunicorn/app/wsgiapp.py", line 57, in load
return self.load_wsgiapp()
~~~~~~~~~~~~~~~~~^^
File "/home/teamai/.venv/lib/python3.13/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
return util.import_app(self.app_uri)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/home/teamai/.venv/lib/python3.13/site-packages/gunicorn/util.py", line 370, in import_app
mod = importlib.import_module(module)
File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/teamai/app_main.py", line 5, in <module>
import agents
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "/home/teamai/.venv/lib/python3.13/site-packages/wrapt/importer.py", line 224, in _self_exec_module
notify_module_loaded(module)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/home/teamai/.venv/lib/python3.13/site-packages/wrapt/importer.py", line 151, in notify_module_loaded
hook(module)
~~~~^^^^^^^^
File "/home/teamai/.venv/lib/python3.13/site-packages/ddtrace/_monkey.py", line 277, in on_import
imported_module.patch()
~~~~~~~~~~~~~~~~~~~~~^^
File "/home/teamai/.venv/lib/python3.13/site-packages/ddtrace/contrib/internal/openai_agents/patch.py", line 76, in patch
wrap(agents.run.AgentRunner, "_run_single_turn", patched_run_single_turn(agents))
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/teamai/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 183, in wrap_function_wrapper
return wrap_object(target, name, FunctionWrapper, (wrapper,))
File "/home/teamai/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 85, in wrap_object
(parent, attribute, original) = resolve_path(target, name)
~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/home/teamai/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 52, in resolve_path
original = lookup_attribute(parent, attribute)
File "/home/teamai/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 48, in lookup_attribute
return getattr(parent, attribute)
AttributeError: type object 'AgentRunner' has no attribute '_run_single_turn'Reproduction Code
No response
Error Logs
No response
Libraries in Use
ddtrace==4.4.0
openai==2.20.0
openai-agents==0.8.4
Operating System
Linux 6.17.0-14-generic #14~24.04.1-Ubuntu
Reactions are currently unavailable