Unmanned Aerial Vehicle (UAV)-assisted Mobile Edge Computing (UAV-MEC) systems have emerged as a promising solution for providing efficient computational services to Terminal Devices (TDs) in remote areas or emergency situations, owing to their high flexibility and mobility. However, optimizing UAV flight trajectories while minimizing task computation latency remains a significant challenge. This paper proposes a novel dual-agent framework called SAC-UTO (Dual-Agent SAC-Based UAV Trajectory and Task Offloading Optimization), based on the Soft Actor-Critic (SAC) algorithm from Deep Reinforcement Learning (DRL), to optimize task offloading strategies and trajectory planning in UAV-MEC systems. Our approach comprehensively considers TD task offloading scheduling priorities, real-time UAV flight trajectories, and optimal offloading rate allocation among local, UAV-MEC, and Ground-MEC nodes. We model this problem as a mixed-integer nonlinear programming problem and achieve hierarchical decision optimization through two collaborative yet functionally separate agents: Agent 1 optimizes global strategies, focusing on TD task offloading scheduling priorities, while Agent 2 dynamically optimizes UAV flight trajectories and task offloading rates across computational nodes, given the scheduling priorities. By incorporating flight distance factors into the delay reward function, our method reduces UAV flight distances while maintaining equivalent computational latency.