Closed
Description
Describe the bug
A background thread is created when the library is imported. This thread is used for tracing and having tracing disabled has no effect on this, as it is evaluated after the thread creation.
This is in my opinion quite bad and it causes issues in our environment, where we use process-based parallelization and require no extra threads to be running at the startup of the program. I am working around this by importing anything from the agents
library inside my functions, not in the global file scope. Not ideal though.
Debug information
- Agents SDK version: 0.0.16
- Python version: Python 3.13
Repro steps
import threading
assert threading.active_count() == 1
import agents
assert threading.active_count() == 1
Expected behavior
My expectation would be, that the thread will be created either explicitly, or when needed - for example when the first Runner.run
is called, or some tracing functionality is explicitly used for the first time.