A robot commits libel. Who is responsible?

For all their apparent infallibility, bots, like their human predecessors, are also vulnerable to mistakes.One of the worst mistakes is committing libel. How should courts treat cases in which a robot generates a defamatory statement?