I don't believe it means agent. The abbreviation is used in several other documents in the same series and seems to have its normal meaning of against.(see for example https://www.londonlives.org/browse.jsp?div=LMSMPS50645PS506450054 where the defendent is female no king's agent would be a woman ( EDIT this was not a woman as Ros points out; this one https://www.londonlives.org/browse.jsp?div=LMSMPS50645PS506450072
I agree it seems to read as if John was the defendent (thats what I first thought) but if he was the defendent I'm perplexed as to why it was that he that owed the crown money. (a defendent remanded to gaol would pay gaol fees but £40 is a lot; the paupers gaol fees charged for Dorchester gaol in the 19th C were shillings a week There weren't really any fines. )
It makes more sense if Jewers is about to appear in court for fraud and that the prosecution of means the prosecution brought by John Stanway.
My guess (and it is just a guess) is that the cost has something to do with the payment of costs for witnesses and court expenses. Note the debt is acknowleged on condition of the ''pros: the deft. Jewers.
Until the 19th C except for a few cases such as forgery and treason the crown didn't bring prosecutions. It was the person alleging the crime who decided to prosecute and was therefore liable for the costs of the prosecution .From the mid 1700s the court had the power to repay these costs and you often see justices awarding expenses to cover the costs of witnesses. However, until 1778 in the event of an unsuccessful prosecution the person bringing the prosecution was liable for all costs.
See http://www.daviddfriedman.com/Academic/England_18thc./England_18thc.html
(Note; I went for that article because its well explained but it is written by an American so his comparisons are to the US today, not England )