If a judge of a court of record in any other state, which by its laws has made provision for commanding a prisoner within that state to attend and testify in this state, certifies under the seal of that court that there is a criminal prosecution pending in such court or that a grand jury investigation has commenced, and that a person confined in a New York state correctional institution or prison within the department of corrections and community supervision, other than a person confined as criminally mentally ill, or as a defective delinquent, or confined in the death house awaiting execution, is a material witness in such prosecution or investigation and that his or her presence is required for a specified number of days, upon presentment of such certificate to a judge of a superior court in the county where the person is confined, upon notice to the attorney general, such judge, shall fix a time and place for a hearing and shall make an order directed to the person having custody of the prisoner requiring that such prisoner be produced at the hearing.
If at such hearing the judge determines that the prisoner is a material and necessary witness in the requesting state, the judge shall issue an order directing that the prisoner attend in the court where the prosecution or investigation is pending, upon such terms and conditions as the judge prescribes, including among other things, provision for the return of the prisoner at the conclusion of his or her testimony, proper safeguards on his or her custody, and proper financial reimbursement or other payment by the demanding jurisdiction for all expenses incurred in the production and return of the prisoner.
The attorney general is authorized as agent for the state of New York, when in his or her judgment it is necessary, to enter into such agreements with the appropriate authorities of the demanding jurisdiction as he or she determines necessary to ensure proper compliance with the order of the court.
N.Y. Crim. Proc. Law ยง 650.10