In sport science the two terms are often separated. Change of direction (COD) is a pre-planned movement; agility includes reacting to a stimulus, such as an opponent or a ball.
COD depends on deceleration ability, strength, technique and body position
Agility adds perception and decision-making, which can be the limiting factor in game situations
Planned COD tests such as the 5-0-5 do not fully reflect reactive agility in sport
Training both is useful: planned drills for mechanics, reactive drills for game-like situations
A simple progression: start with closed drills such as a 5-0-5 or a 90-degree cut on a cue you know in advance. Then add a partner pointing left or right at the last moment. Finally, use small-sided games or mirror drills where the reaction is unpredictable.