The boy, 14 at the time, groomed his friend, then 15, with an "elaborate matrix of deceit" involving a series of fictional identities in the chatroom.
The older boy, boy A, tried to kill his friend, boy B, on the orders of the "spy", Manchester Crown Court heard.
He believed that by doing so he would be recruited as a British secret service agent and would be rewarded with a sexual relationship with the spy, a middle-aged woman.
But, in reality, boy B had fallen in love with boy A, tricked him into performing sex acts on a webcam and conned him into stabbing him twice in Altrincham, Greater Manchester.
Posing as the spy and promising sex and money, boy B sent messages to boy A ordering him to stab his friend to death.
The following day, June 29, 2003, boy A "carried out his orders to the letter" and stabbed boy B once in the chest and once in the stomach. But Boy B did not die and spent a week in hospital in Manchester before recovering.
Boy A pleaded guilty to attempted murder and boy B pleaded guilty to perverting the course of justice and incitement to murder.
Boy A was given a two-year supervision order and banned from any contact with Boy B.
Boy B was given a three-year supervision order, banned from any contact with Boy A and was told he must only access the internet under adult supervision and must not enter chatrooms under any circumstances.
Judge David Maddison told the boys as he passed sentence: "I accept the thrust of the arguments advanced which are that there are a number of extraordinary features associated with this case.
"Skilled writers of fiction would struggle to conjure up a plot such as that which arises here.
"It's staggering to be dealing with a case that arises out of a 14-year-old boy's invention of false personalities, false relationships and events arranged for his own killing at the hands of a 16-year-old boy who he had met via an internet chatroom."
The "highly intelligent" Boy B introduced himself to the "gullible and naive" boy A posing as a teenage girl on an internet chatroom in early 2003, the court heard.
Boy A was then introduced to a series of other fictional characters by Boy B and the pair met in person and became friends.
The pair spent hours, "sometimes six or seven hours", chatting on the internet, with Boy B assuming a number of identities as well as his own.
Nick Clarke, prosecuting, said: "It was like an internet soap opera . . . each character and story line more fantastic than the last. All of the story lines were being created in Boy B's head."
The court heard Boy B drew many of his ideas from films such as James Bond, Men In Black and Catch Me If You Can.
Boy A was also fooled into believing Boy B was suffering from a brain tumour and only had one week to live.
It was then that the spy, who boy A was now in love with, ordered him to kill Boy B in return for £500,000 and the chance of a sexual relationship.
A message sent on the night of June 28, 2003, instructed "Agent 47695" to stab him to death.