BOSTON — Uber has reached an agreement with Boston to share information about the trips passengers take using its on-demand service, a turnaround for a company that in the past has been reluctant to hand over data to government regulators.

Uber, which announced the deal Tuesday, says it will provide Boston with the distance and time passengers traveled using the ride-hailing service, as well as general pickup and drop-off locations. The San Francisco-based company promises the information, which it will provide quarterly starting in about two weeks, will be anonymous and protect drivers’ and passengers’ personal information.

Meghan Joyce, general manager of Uber Boston, said Wednesday that the data can help city officials adjust traffic light patterns, reduce road congestion, focus transit investments and prioritize street repairs. “The implications for the insights that come out of this data are enormous,” she said.

Jascha Franklin-Hodge, Boston’s chief information officer, says the information will also help on a range of planning and development decisions. “For us, it’s really a tool to look at the overall characteristics of roadways, trends and changes,” he said. “It’s not a tool to zoom into every detail of every individual and ride. That’s not our goal here.”

Uber, which has fought other government requests for similar data, says it hopes to reach similar agreements in other U.S. cities.

Uber is in a court battle with the California Public Utilities Commission over trip data. The agency made submitting the data a condition of approving ride-hailing services, which generally allow users to request and pay for a car service through their cellphones. Uber has refused to turn over the data even as competitors Lyft and Sidecar have.

In New York, Uber recently rebuffed a request by the city’s Taxi & Limousine Commission for trip data, citing privacy concerns. Joyce, of Uber, declined to address the New York and California disputes, but said the company is in talks with many cities and states about data sharing.

Uber is so far the only ride-hailing service to reach such an agreement with Boston. But rival Lyft says it’s also open to “working with cities to see how ridesharing services can inform transit planning,” noting that the San Francisco-based company has provided similar data in other jurisdictions.

Uber’s agreement with Boston comes as city and state officials are looking to impose new regulations on ride-hailing services.

The state has proposed requiring that ride-hailing companies obtain state operations certificates, conduct criminal background checks on drivers and carry proper insurance, among other things. Boston, meanwhile, has formed a Taxi Advisory Committee that Chairman Christopher English says will “continue to explore mechanisms to complement” what the state is developing.

Franklin-Hodge says Boston’s transportation department, neighborhood development department and redevelopment authority will have access to Uber’s trip data, but there’s no restriction to other city agencies using it.