Every year, thousands of New Yorkers find themselves responsible for a surprise medical bill from a doctor, like an anesthesiologist, who becomes involved in their care but, unbeknown to the patient, is not covered by their insurance.

Now a provision in the state budget agreement announced Saturday is intended to protect consumers by requiring that they be given a reasonable amount of notice when an out-of-network doctor will be treating them.

If they are stuck with a surprise bill, patients will be responsible only for whatever their co-pay would be if the doctor were in-network. The out-of-network doctor and the insurance company will have to hash out the bill using what is known as baseball arbitration, with each proposing a price and an arbitrator choosing one of them. The law will go into effect in one year.

“The heart of the bill came out of the fact that the No. 1 complaint on health insurance issues we receive year after year is people who get stuck with surprise balance bills,” Benjamin Lawsky, superintendent of the state’s Financial Services Department, which regulates insurance, said on Sunday.