Usage of by in your context has a meaning of near or at the side of someone:
A small child stood sullenly by her side.
He wanted to keep her close by him always.
The policewoman walked by (= past) them without saying a word.
Usage of with in your context has a meaning of having or including something:
A tall woman with dark hair
Two coffees please, one with milk and one without.
We're an international company with offices in Paris, New York, and Sydney.
He woke up with a terrible headache.
Now lets have a look at accompanied:
..to go with someone or to be provided or exist at the same time as something:
The course books are accompanied by four CDs.
Depression is almost always accompanied by insomnia.
The salmon was accompanied by (= served with) a fresh green salad.
see? Almost in every situation it is used with by to express the feeling of near or at the side of someone.
So if you use with, it will give the impression of "not necessarily but still accompanied" by having the meaning "having or including something" and if you use by instead, it will give the impression of "someone is intended to be accompanied".
resource: Cambridge Dictionary