Control armature through blender script

Hello everyone
I’m new here :slight_smile:
Can someone explain to me how to change the angle/position of each bone through the script?
That is, I want to write code that if condition X is met, then the character will make movement A
And if condition Y is met, then the character will make movement B

If someone could help me by writing some simple lines of code that would be very helpful

Thank you very much everyone!!

image