Assuming mankind will eventually create artificial humans, but in doing so have we put equal effort into how humans will relate to an artificial human, and what can we expect in return? This is happening in real-time as we place AI trucks and cars on the road. Do people have the right to question, maybe in court, if an AI machine breaks a law?
For those times when AI does interact with humans, I believe that AI would be held at LEAST to the same standards humans are. The problem comes in when we ask "who is really to blame". If a self-driving car cuts you off in traffic and causes you to wreck, you can't take the AI in the car to court. Do you take the company? The programmer? The owner of the car? Some entity will likely be held responsible, the question is just which one.
As for future human-like AI, I believe my answer still remains true. Having a human level AI changes the meaning of the word "entity". If a human-like AI breaks a law, it may be because it was programmed to do so. I don't think our current legal system is ready for such cases, but it have to evolve in the future.
As per the current legal system, if the AI agent were to be given a human citizenship, then yes, it would have to obey all laws as per the legislature of the country which provided the citizenship. If not then the entity who holds responsibility over its control and creation would be trialled (see also this scenario).
Having stated the above, it really is not as simple as it sounds. as @Tyler pointed out, the entity in here is not of a single person. If the AI agent were to take part in a malevolent act, then a more thorough investigation must be taken place than that for a human. If humanoid robots of free will were to roam our civilization, then our legal system ought to be expanded to cope up with possible real life anomalies that could occur.