California Governor Gavin Newsom signed a package of laws on Thursday restricting how employers use artificial intelligence in decisions about workers.

Employers will be barred from relying solely on AI to decide whether to fire someone, using it to infer employees’ emotions or collecting data from electrical activity in their brains or nerves. The laws also require companies to tell workers when AI caused layoffs and prohibit AI surveillance in workplace bathrooms.

The measures address concerns about job losses, discrimination and monitoring at work. California is among the first US states to adopt a broad set of workplace AI rules; Colorado, Connecticut, Illinois and Texas have passed narrower measures.

Unions and worker advocates pressed for the changes. Lorena Gonzalez, president of the California Federation of Labor Unions, said the federation also wants employers to disclose when they use AI at work, after a bill on that issue stalled in a state assembly committee this year.