Well, First we have to understand the difference between ballistic missile and guided missile . Ballistic missiles are missile which follows a particular trajectory and it is launched to the higher layer of earth atmosphere in the initial stage and the later part is not much powered by fuel as it hit the target with the help of gravity .
Ballistic missiles are very difficult to intercept as it travels at high speed approximately 30 times more than the speed of the sound.
And ballistic missiles travel mostly in predefined trajectory and it cannot alter it’s trajectory once launched. And ballistic missiles are used for long target and mostly used for intercontinental missions , Agni 5 is an intercontinental ballistic missile.
Now coming to guided missiles, these are operated by the flight mechanism and it travels by constant speed, it also powered by a scramjet engine or cryogenic engine to power the missile for movement.
This missile system got complex electronic guided part which can alter the direction and change the trajectory even after launching ,these are high precision missile which can take down target accurately and there are fire and forget type which track down the object even it is moving in different direction, but unlike ballistic missiles ,the speed of the missile is much low and is between mach 2 to 4 or 6 to 7 times the speed of the sound.
So both missile systems are different for different objectives. S-400 system is an anti aircraft and anti missile system ,which is used to take down an incoming air threat. This is can intercept incoming missiles or aircraft successfully and is designed for that particular objective .
Whereas ballistic missiles are used to destroy a ground target which is predefined . It is not used to intercept any missiles or aircrafts. So ballistic missiles cannot be used against anti aircraft or missile.
So Agni missile cannot be used against intercepting the S400 system , but India has many other anti missile defense system like , Indian akash system , Israeli barrack system, Brahms air defence system and American IAMD and SMDC and the future induction of S400 system.
Ballistic missiles are very difficult to intercept by any counter missiles, no system in the world claim complete supremacy over ballistic threat. Ballistic missiles travel more than 30 times the speed of the sound, whereas missile systems like S-400 and any other counterparts can travel maximum 3 to 6 times the speed of sound . Besides ,the present ballistic missiles are based on MRV ( multiple reentry vehicle ) technology ,where a single ballistic missile can carry multiple warhead and can split and hit multiple target . So intercepting such ballistic missile is merely impossible.