Bending an Armature with Programming

I have had this question for a long time, and I have looked over the forums and the internet and found nothing on the topic. So, my question is, is it possible to bend an armature in game with coding. This use for this is to make it so a character’s upper torso rotates back 'n forth with the mouse as it goes up and down. If anyone has any clue how to do this or what I’m asking, could you please show me how or link me to a place that shows me how.

It will be much appreciated,

My armatures (from Max, blender …) show up with the bones as just transforms, childed inside of each other (shoulder, upperLarm, lowerLarm … .) Just find them the usual way, and change transform.localRotation.