Is it possible to get last request info from mitmproxy daemon while it running?

In examples there is a script to save flow object as har archive. The process suggests mitmproxy daemon writing all info into flow object (-w) and then converting this flow into har archive after daemon finished working.

What i’m trying to achieve is getting requests info in real time. Like sending request through rest to daemon or connecting via socket to flow from another script (separately ran). So asking what is the best way here.

If you want mitmproxy -> daemon communication, you can just write your own addon that informs your daemon. If you want daemon -> mitmproxy communication, you can either write your own addon that runs a server, or check out mitmweb’s HTTP/WebSockets API.