In act 2, scene 2 of Shakespeare's Hamlet, it's not until very near the end of this very long scene that Hamlet's intentions regarding the troupe of travelling players (actors) becomes clear. It's entirely possible that it doesn't even become clear to Hamlet until very near the end of the scene how he intends to make use of the players.
The scene itself is full of conspiracies, so it only seems appropriate that Hamlet should fashion one of his own. The scene opens with Claudius and Gertrude conspiring with Rosencrantz and Guildenstern to spy on Hamlet, to "glean ... what afflicts him." Later in the scene it becomes apparent that Rosencrantz and Guildenstern really aren't very good at spying on Hamlet, who sees through their feeble, transparent attempts to "glean ... what afflicts him" and turns the tables on them, which Hamlet does again in act 3, scene 1.
In this scene Claudius and Gertrude also conspire with Polonius to have Claudius and Polonius spy on Hamlet from "behind an arras" while he talks with Ophelia. This spying occurs later in the play, in act 3, scene 1.
The troupe of travelling players arrives, and after Hamlet has the lead actor perform a lengthy monologue from a play about Dido and Ǽneas for him, Hamlet conspires with him—although the actor doesn't actually know that he's conspiring with Hamlet—to perform a play at court entitled The Murder of Gonzago, into which Hamlet asks if he can insert "some dozen or sixteen lines" of his own devising.
In the last twenty lines of the scene, Hamlet explains his reasoning for this. At some time in his life Hamlet heard that people watching a play have sometimes been so moved by a scene that they feel guilty about something they've done and "proclaim their malefactions." Hamlet thinks that this might work to cause Claudius to confess the murder of Hamlet's father, which will confirm what his father's ghost told him and give Hamlet the proof he needs to take his revenge on Claudius for the murder.
"The play's the thing," Hamlet says, "Wherein I'll catch the conscience of the King."