One thing is confusing about your question: if a person enters into a plea agreement, there is not going to be a trial. A plea agreement means they plead guilty and there is no trial, no plea agreement probably means a plea of not guilty and, ultimately, a trial.
What you may be asking is, if a person enters a plea agreement while they have been out on bond for the past six months, can they then be held until the sentencing date. That is sometimes a matter of discretion for a judge, but other times, and this often happens in drug cases where the defendant faces high mandatory minimum punishment(s), the law does not even give the judge that much discretion, the defendant has to be taken into custody until the sentencing date. It would not be surprising if, at or shortly after the plea hearing, a sentencing date was set for 3-6 months out while the PSR is prepared, objections are entered, etc..
So the judge may have discretion to let the person out or he may not, depending on the the specifics of the plea and some other details of the case. If there are high mandatory minimums involved, the judge may well NOT have the ability to let the person stay out until sentencing.
If the defendant was remanded, it was because of his or her detention hearing produced one or both negative results: the judicial officer found that the person is 1) a flight risk or 2) danger to
the community. Usually in drug cases #2 always applies. The Court should consider all other options before remanding. It must consider the 18 USC 3142(g) factors to mitigate full remand. This has a lot to do with the defendant's attorny and the facts of the defendant's background. Sometimes all it takes is a relative or responsible person to act as custodian. See the link below.