[Bug]: Program hangs if I call agentops.record 100 or more times
Contact Details
No response
📦 Package Version
0.3.13
🎞️ Framework Version
No response
🔎 Describe the Bug
Calling agentops.record 100 or more times in a program causes it to hang, and it seems consistent. It appears to be a deadlock at line 303 of agentops/session.py.
Example program reproducing the bug:
import agentops
from agentops import ActionEvent
agentops.init(default_tags=["agentops-debug"])
N = 100
for _ in range(N):
agentops.record(
ActionEvent(
action_type="Agent says hello",
params="hi",
returns="bye",
)
)
agentops.end_session("Success")
Changing N to a larger number similarly causes the program to hang, but if N is smaller (such as 99) then the program no longer hangs. It appears to be related to self.max_queue_size = 100 at line 13 of agentops/config.py.
🤝 Contribution
- [ ] Yes, I'd be happy to submit a pull request with these changes.
- [ ] I need some guidance on how to contribute.
- [X] I'd prefer the AgentOps team to handle this update.
OK I fixed the bug by unindent lines 234-235 in agentops/session.py. Because they try to acquire a lock, putting them under the with self.lock block causes a deadlock.
OK I fixed the bug by unindent lines 234-235 in
agentops/session.py. Because they try to acquire a lock, putting them under thewith self.lockblock causes a deadlock.
Thanks for pointing this out! Will try to get a patch in ASAP.
Out of curiosity-- what kind of agent are you using that records more than 100 actions simultaneously?
we've overhauled the sdk since this, shoudnt be an issue anymore :)