How can I use code executor to know if a agent is online or not?
There is no such functionality at present.
Please describe what exactly you want to achieve and see if there is a workaround
I want to know if there is an online agent at the present moment before transfering the client to live chat, so I can inform the client correctly if there is anyone to chat with or not.
Upon checking we do not support such feature yet.
Recommended solution is to suggest to chatbot users "keep this tab open and we will reply ASAP" alternatively leave your number and we will message/call you when we can. (with a question block)