AI Agent Hangs on long tasks in self hosted instance

Hi, I am self hosting in Coolify. I am creating a flow where the agent has to generate a long text, when i press step in that step, the agent starts but after a couple of seconds a pop up show “Connection lost”, sometimes the agent resumes and then later is left hanging while showing “agent thinking”, some times it hangs immediately after the pop up. I tried this solution: [BUG]: AI Agents fail to create due to Kubernetes networking constraints · Issue #9038 · activepieces/activepieces · GitHub and changed AP_INTERNALL_URL but it did not work. I think the agent is indeed runing and completing the steps, but the frontend is not updating.

Has anyone faced the same issue and can provide some guidance?