Merely communicating with a another software X does not make your software a derived work of X. There are no copies, modifications, or derived works of X involved here so the license of X does not apply to you. You are free to license your code in whatever way you like and are not bound to the AGPL.
In particular, restricting yourself to available documentation and to reverse-engineering techniques such as observing network traffic makes it clear that you are not copying any X code.
Not all kinds of communication between two software components keep them as clearly separate works. The data flow may be so entangled and intertwined that they cannot be reasonably considered separate. However, that doesn't seem to be the case here as the JSON messages define a clear interface between X and your software.