Terahertz (THz) communication networks, combined with Intelligent Reflecting Surfaces (IRS), hold significant potential for advancing the capabilities of Sixth-Generation (6G) wireless systems. The integration of these technologies offers opportunities for ultra-fast data transmission and substantial improvements in network capacity, meeting the growing demand for higher bandwidth and faster connectivity. This study investigates the use of flying IRS-assisted Unmanned Aerial Vehicles (UAVs) within a THz communication framework, aiming to overcome challenges in environments with complex signal propagation, such as urban settings. To facilitate this integration, we introduce the Fly-IRS algorithm, designed to optimize key aspects of network performance, including user device grouping, IRS phase shifts, and UAV positioning. These factors are critical for maximizing data transmission rates, boosting network capacity, and minimizing service disruptions that affect user experience. Our approach leverages a combination of Multi-Agent Deep Reinforcement Learning (MADRL) and Particle Swarm Optimization (PSO) to effectively handle user grouping, IRS phase shift optimization, and UAV trajectory planning. By merging the strengths of both techniques, the Fly-IRS algorithm enhances system adaptability and efficiency. Simulation results demonstrate significant improvements in data rates, with the Fly-IRS algorithm delivering up to 10% better performance compared to the MADRL method alone. These findings highlight the transformative potential of integrating THz communication networks with IRS and UAV technologies, emphasizing their ability to shape future wireless communication systems. This innovation could lead to more reliable, high-capacity networks, capable of addressing the advanced requirements of 6G, offering improved service quality even in difficult environments.