Ronsencrantz and Guildenstern (R & G) are somewhat mysterious figures in the play, as they are definitely old friends of Hamlet, but they are also definitely sent for by King Claudius to work for him to find out whether Hamlet is attempting to usurp the throne. In the play, Claudius only mentions, upon their arrival in Act II, scene ii, the following:
The need we have to use you did provoke
Our hasty sending.. . .I do entreat you both
That being of so young days brought up with [Hamlet],
That you vouchsafe your rest here in our court,
. . .To draw him on to pleasures and to gather
. . .Whether aught to us unknown afflicts him. . .
The King is good at veiled language, but, as the events of the play progress, R & G are revealed to the audience and Hamlet as sort of hired thugs meant to assist Claudius in getting rid of Hamlet. This is most evidenced in Act IV scenes ii and iii. And Claudius pronounces at the end of IV, iii that he intends to send Hamlet to England and to his death:
And England, if my love thou hold'st at aught,
. . .thou mayst no coldy set
Our sovereign process, which imports at full,
By letters congruing to that effect
The present death of Hamlet.
So, R & G are meant to be in conveyors of Hamlet to his death in England. However, Hamlet outsmarts them. Upon his return to Denmark in Act V, he relays to Horatio that he switched a letter condemning R & G to death with the one that they carried from the King condemning him. In this way, the King of England put R & G to death in place of Hamlet.
For the quote from Act V relating this switch and more on Rosencrantz and Guildenstern, please follow the links below.