#How can I implement a message listener / event trigger?

8 messages · Page 1 of 1 (latest)

storm briar
#

I'd like to stream data via a websocket connection (I'm using FastAPI) everytime a message is sent by an agent. how can I achieve this?

stable spruce
storm briar
storm briar
#

@stable spruce I've spent some time with this and realised that only the UserProxyWebAgent is configured to send messages back via the websocket with set_queue, a class method of UserProxyWebAgent. How can I achieve the same behaviour for regular agents? I'm hoping not to have to make them all UserProxyWebAgents. I also thought I could have a function in user_proxy that intercepts and sends every message exchanged, but that seems hacky and not good.

stable spruce
storm briar
#

so this is what Im trying to do. I followed your UserProxyWebAgent pattern and did something similar for AssistantAgent. Some messages come through, some don't. I'm still debugging. What do you mean by "the websocket could be reused with some json message"?

stable spruce
#

You could use a json message on websocket and inform which agent is talking like { "agent": "<name>", "message":message } so this way on the UI you can check who is sending the message

storm briar
#

Thank you. One last question, after giving AssistantWebAgents queues and setting them, I find that sometimes the messages do not get sent. Only some of them. Did you have any experience with this and why this happens?