“The Tailor of Panama” casts Pierce Brosnan as a British agent — no, not that one. In director John Boorman’s astutely comic film version of John Le Carr’s 1996 novel, Brosnan plays Andy Osnard, an unscrupulous operative downgraded to duty in dull Panama. Playing a villain becomes Brosnan; he’s looser, sexier, edgier. Still, the show belongs to Geoffrey Rush in a note-perfect performance as Harry Pendel, the tailor who caters to his “gentlemen” with the finest Savile Row worsteds. “Mr. Connery’s preference,” says Harry , who is a droll liar, an ex-con hiding his past from his wife (Jamie Lee Curtis) and two children. How Andy abuses this genial tailor, and the tragic results of Harry’s revenge, are the stuff of a hypnotic film that stays resonantly humane even as Boorman skewers British and American diplomacy with martini-dry wit.