A robotic surgery system includes a robot and an instrument assembly. The instrument assembly includes a drive unit with at least one rotary drive having an electric motor and a drive shaft that has a coupling part for coupling to a drive shaft of the instrument an instrument including an instrument shaft and a drive shaft that has a coupling part for coupling to a drive shaft of the drive unit and an instrument interface including a sheath that encompasses the drive unit. In order to detachably couple an instrument module to an instrument part of a surgical instrument, an electromagnet in a magnet assembly of the instrument module is activated or deactivated, a permanent magnet of said magnet assembly is moved into a locking position and/or an angular position of a coupled counter element assembly of the instrument part is detected by an angle sensor of the instrument module.