Many operators for pose bones (including those for constraints) rely on having an active bone to refer to. However, how do we set this?
The answer is simple, though perhaps non-obvious:
arm = bpy.data.armatures["MyArmature"]
arm.bones.active = posebone.bone
where posebone is a pointer to some bone you've obtained from "object.pose.bones"
That's it. Simple :)