Military spaceship wants to perform a boarding action on another spaceship, while both are performing high G manevuers (about 2G let's say). It's too hard to immobilize the enemy ship, so they won't try to dock to enemy ship, but will send a boarding party on a fast, small vehicle. The vehicle rams into enemy ship, cuts external armor open, and lets some combat drones inside. They get into habitat of the spaceship, and perform whatever task they were ordered. The interior of spaceship is cramped, full of tight spaces, and ship performs manevuers all the time, constantly changing acceleration vector. The question is, what is the best shape for such drone, and what would be the best armament for them, so they can effectively fight inside the ship?
Assumption: this is not explicitly stated in question, but from wording I infer that ships are crewed.
You want vacuum capable autocanon spiderdrone.
Since I couldn't find any relevant spider or spiderdrone images, I will explain reasoning using human climbers as reference.
You want to adapt one of the crack climbing techniques.
By pressing body against one wall, and legs against other, or one leg against one wall and other against other wall it is possible to climb wide enough crevice even if it is completely devoid of handholds or footholds.
You want your drone to be able to do the same, just with more legs, so that drone at any moment can be ready to counter any direction of acceleration, while still having some legs free to make next "step". Place rubber, or another high friction material along entire legs, and joint covers, so that drone can use any leg part to lock itself against wall. Since your ships are cramped, this technique is perfectly viable, without making legs impractically long.
It's easy to assume that since robots don't need to breathe, they don't need air, nothing further from truth. Machines in general still need air to operate, mostly for cooling, and need to be specifically designed to operate in vacuum. For reasons described in next paragraph you want your drone to be vacuum capable.
I would go with either machine gun or autocannon, depending on ship armour. You want lightest weapon that is still capable of penetrating hull and personal armour, assuming that in your universe machine guns or autocanons can penetrate hull, that is.
Why? Because you are in space, and space is inherently inhospitable. Why bother yourself with using weapons that can't breach hull? Just vacuum seal yourself and blast away, make enemy worry about hull. Do away with trigger discipline and fire wildly, sometimes just shoot a wall for good measure. If enemy crew aren't in vacsuits, they will be in trouble. Even if voiders (infantry trained in boarding actions and repelling boarders, like marines of XVII century, except they are not "space marines", because those are an oxymoron) do take out your drone there still is a problem of multiple hull breaches, and crew won't be able to operate in comfort of plain clothes we see on movies so often. They will need vacsuits, which will impair their efficiency to some degree. That way, drone actively operates as area denial weapon, which means that enemy voiders might have to accept higher loses, just to make sure drone doesn't render entire ship unusable. Besides, you are deploying drone by breaking through hull, why shouldn't you take this to logical conclusion?
And all that is just a bonus on top of using anti-personnel weapon. Even if your drone fails to kill enemy crew, it may tear up the ship enough for them to surrender. Or since it's a drone, it might use the very same weapon to shoot up engine or fuel tanks, or threaten doing so to force surrender, or shoot up central computer, or any other part which would make ship stop evading and allow your ship to dock and send voiders.
If aforementioned weapons can not pierce hull, just use whatever anti-personnel weapons are there, and make your drone carry a couple of breaching charges.
If the enemy ship is still under thrust and pressurized, you would need someting like this If you can expect derpessurization, it needs to have thrusters too. In both case magnetic clamps are needed. Firearms or micro missiles could do the job, but if electronics are cheap enough, you could simply have the majority of the drones as flying grenades/shaped charges, deploying only some larger units to take prisoners, salvage or interface with ship systems.