Hollywood studios are expected to retain the right to train artificial-intelligence models based on writers’ work under the terms of a tentative labor agreement between the two sides, citing people familiar with the situation.

The writers would also walk away with an important win, a guarantee that they will receive credit and compensation for work they do on scripts, even if studios partially rely on AI tools, one of the people said. That provision had been in an earlier offer from the Alliance of Motion Picture and Television Producers, the group representing studios, streamers and networks. The Writers Guild of America said Sunday it had reached a tentative agreement with the AMPTP to end a nearly five-month strike. Neither side has released the details of the agreement. The WGA said it plans to release the terms once its leadership votes on the deal, which could happen as soon as Tuesday.

The two sides have battled over issues ranging from wage increases to whether writers’ rooms should have minimum staffing requirements. The use of generative AI by studios became a major issue, as advanced versions of the technology — such as OpenAI’s ChatGPT — were released for public use over the past year. AI bots, which provide sophisticated, humanlike responses to user questions, are “trained” on large amounts of data. Entertainment executives didn’t want to relinquish the right to train their own AI tools based on TV and movie scripts, since their understanding is that AI tech platforms already are training their own models on such materials, people familiar with the matter said.