Martha Wells’ 2020 Network Effect is the first novel and fifth installment in her ongoing series, Murderbot Diaries.
Having escaped from the mercilessly exploitive Corporation Rim for the comparative safety of Preservation System (and more remarkably, having not lost any of its human associates in the process, despite said humans having the self-preservation instincts of day-old rabbits), Murderbot is finally free(ish) to find a new place in life that doesn’t involve being an expendable slave.
This is quite the challenge. Rather conveniently, a real-world crisis intervenes before Murderbot gets too caught up in a crisis of self-definition for which it has few applicable tools. Space raiders!