Here's the basic AI structure.
Condition FE
Action FE
FF
Condition FE
Action FE
FF
The first block is action, and the second is reaction. Conditions are always 4 or 8 bytes long, actions vary in length and can have as many per block as you want, unless you start with the randomizer, in which case there must be 4 to choose from.
05 01 00 00 FE 02 7F 03 00 00 FE FF 00 00 00 00 00 FE 00 00 00 00 00 FE 00 00 00 00 FE FF
In this section here, the bolded is being read as the displayed message for the Guest's final attack. It then hits an unexpected FF, which based on the Red Beast's behavior, should cause it to end the section.
In the red, there's a 5 byte action, so it'll get lopsided there, but it should have ended prior to that.
I'd double check all lengths in your commands to make sure they're right.