In the passé composé (and in all compound tenses), sortir is conjugated sometimes with être, sometimes with avoir. It all depends on one question to ask after the verb: sortir quoi ? (take out what?)
1. No direct object → être
Someone leaves a place: it's a movement, meaning « to go out ». The past participle agrees with the subject, as with aller, partir or venir.
2. With a direct object → avoir
Someone takes something out: the verb means « to put outside », « to pull out of ». The past participle doesn't agree with the subject.
Watch the agreement with avoir
When the direct object comes before the verb (a pronoun like la, les, or que), the past participle agrees with it.
Other verbs follow the same rule
Monter, descendre, rentrer, retourner and passer also change auxiliary depending on whether they have a direct object or not:
The test to remember: after the verb, ask « quoi ? » (what?). No answer → être (agreement with the subject). An answer → avoir (no agreement with the subject).