There's been somewhat concrete info on how Gen 1's AI works written up, which you can find
here
Anyways, programming an actual AI to play mons is probably a massive pain in the ass; Pokemon is an incredibly stochastic game, considering the luck elements and how difficult it is to gauge the opposing player's next move, and a game of limited information, so using Reinforcement Learning is really tough. I can't imagine how ridiculous the State and Transition definitions in a Gym Environment would be. It's also harder to explain who is at an advantage or disadvantage in Pokemon since the number of Pokemon left isn't always the best indication, which makes the reward function annoying to define. Most attempts I've heard of making bots haven't been too successful and are usually pretty flowchart-heavy. There's also some accounts that are
probably bots on the Gen 7 Randbats ladder, given their insanely fast move selection and flowchart plays, but I don't think there's any specific info on them publicly available (i.e. I have no idea who made them or where to find the codebase).
I still personally feel like the best way to make an AI is to scrape high-level PS replays and then do learn off of the actions each player takes in various situations, but again, really tough task.