Almost all of the AI is coded in the DLL (C++ compiled code), and the XML permits "constants" within this defined behaviour to be tweaked. There is very little, if any, of the AI coded directly in Lua.
That's not to say that you can't use Lua to change the behaviour of the AI, but you are looking for ways around the base systems. For instance, you could step in at the beginning of every turn (via the GameEvents.PlayerDoTurn hook) and force all the AI cities to the production you calculate is most relevant, or you could hook GameEvents.CityCanConstruct to achieve similar results. You could then determine where all the AI units should be/doing/going and force then to do that via Lua. So while it's possible, some TCs have done it for CivV, it's not easy, as you are not making small/simple changes to existing code, but having to completely override large complex chunks of C++ in Lua