San Francisco is seeking to modernize its bail system by using a computer algorithm to predict whether a defendant might re-offend or bolt if freed from jail, an effort to reform long-standing practices that many in the city’s justice system believe penalized the poor and opened up potential racial bias.

Judges in San Francisco, as in many other California jurisdictions, have long relied on state guidelines that assign bail amounts based on a defendant’s charges, along with case-manager assessments of inmates that some say are prone to subjective interpretation.

Critics complained that many defendants suitable for release were forced to spend weeks or months behind bars before trial simply because they couldn’t raise the thousands of dollars needed to make bail.

The tool that San Francisco has been experimenting with since May doesn’t set a bail amount for an alleged crime. Instead, it weighs a number of factors including the pending charges, the person’s age and rap sheet, and their record of faithfully showing up to court. The tool then makes a recommendation for or against release, which is then sent to a judge who can follow or ignore the advice.

The algorithm, offered to the city at no cost, was developed by the Texas-based Laura and John Arnold Foundation, which used data from the case histories of more than 1.5 million people — in other words, how they performed when released. San Francisco is one of 30 jurisdictions nationwide to try the system, which shares similarities with other predictive criminal justice tools such as those increasingly used by police to target enforcement.

Basing bail decisions on a cold assessment of risk brings the system back to its original purpose, proponents say — keeping those who could be dangerous off the streets, regardless of their ability to post bail. Still, the rollout of the algorithm hasn’t been without tension, and some are frustrated with what they are seeing in San Francisco.

Prosecutors and defense attorneys say they have encountered results from the assessment they do not agree with. Meanwhile, they say, some judges are often refusing to follow the release recommendations.

“I think it has the potential to be a move in the right direction, but when it is watered down or misunderstood or rejected unreasonably, then it’s not clear what good it will do,” said Deputy Public Defender Danielle Harris. “We were excited about having more research and more data being brought into decision-making, but we’ve been disappointed.”

She said prosecutors sometimes ask for high bail or no release despite the tool’s recommendations and District Attorney George Gascón’s support of the algorithm.

Gascón, who was instrumental in bringing the tool to San Francisco, said growing pains were to be expected in the pilot program’s early stages.

“We recognize that there is more work that needs to be done,” Gascón said. “We’re trying to replace a system that has absolutely no connection to public safety with a system that will actually evaluate risk and is inherently more fair and more mindful of public safety.”

Ann Donlan, a spokeswoman for San Francisco Superior Court, said it was “too soon to tell how useful the tool is to our judges when making release decisions.”

San Francisco adopted the system seven months after a national civil rights group sued the city, saying its bail system unfairly punished poor people.

One of the cases that Equal Justice Under Law singled out was that of 19-year-old Riana Buffin, who was arrested for shoplifting and held on $30,000 bail. The district attorney’s office decided not to file charges, but Buffin sat in jail for two days because she could not post bail.

On any given day, 80 to 85 percent of inmates in city jails are awaiting trial, either because they cannot afford bail or because they are being held for serious offenses, said Sheriff Vicki Hennessy.

She said San Francisco has long tried to factor individual considerations into bail. A nonprofit organization working under contract with the Sheriff’s Department conducted face-to-face interviews with arrestees before their first court appearances, then passed its assessments on to a judge.

Now, the nonprofit’s case managers forgo the interviews and run a suspect’s data points through the algorithm. The formula doesn’t consider some pieces of information that critics say are irrelevant to whether someone is a flight risk, but have resulted in nonwhites being jailed in disproportionate numbers — such as whether a defendant advanced beyond high school.

“The idea is to provide judges with objective, data-driven, consistent information that can inform the decisions they make,” said Matt Alsdorf, vice president of criminal justice at the Arnold Foundation.

While some judges won’t trust the system at first, Alsdorf said, “What I’ve seen in other jurisdictions and what I hope to see in San Francisco is that over time ... people will start to see the validity of the tool and start to buy in more and more.”

The new system was on display one recent afternoon in Judge Ross Moody’s courtroom at the Hall of Justice.

Wenceslao Gutierrez, 47, was charged with threatening a Recreation and Park Department employee in Golden Gate Park and stealing gardening shears and a knife. The algorithm suggested he was a good candidate for release with active supervision such as an ankle monitor, as he had a minimal criminal history, said Deputy Public Defender Ilona Solomon. But the prosecution asked for bail to be set at $40,000.

“I believe their office policy is to go with the ... recommendation, so I don’t know why they’re fighting it,” Solomon told the judge.

Max Szabo, a spokesman for the district attorney, said that like judges, prosecutors have discretion to disagree with the assessment’s recommendations. Moody ruled in favor of the prosecution, citing his concern with the threat Gutierrez allegedly made. As of Friday, Gutierrez was still in jail, awaiting trial.

Moody disregarded the findings in another bail hearing that day — and this time it worked in the defense’s favor.

Jaquez Burns, 26, was charged with robbery. The algorithm frowns on release when it comes to several serious offenses, including murder, rape, felony domestic violence and robbery.

Solomon explained that Burns was accused of shoplifting at a department store. Because he had tried to run when he was caught, knocking down two security guards, prosecutors charged him with robbery. The judge remarked that the assessment system treated the robbery charge “as if he held a gun to the person’s head.” Moody disregarded prosecutors’ request for $175,000 bail and set the bond at $50,000. Burns remains in custody.

The public defender’s office pointed to those two cases as exposing the tool’s flaws. But Gascón said that, overall, he had seen an improvement over the old way.

“People should be facing the consequences for their behavior as a result of a trial outcome or plea bargaining, not as a result of being booked,” Gascón said.

Corrin Rankin, owner of Out Now Bail Bonds in Redwood City and area director of the California Bail Agents Association, said the city could reform pretrial detention in another way — by getting to trials quicker.

“Why are you making people wait six months to two years to go through a court case?” he said. “If they truly believed that it’s not fair that someone who can’t afford bail has to stay in jail, give them a speedy trial.”

Vivian Ho is a San Francisco Chronicle staff writer. Email: vho@sfchronicle.com Twitter: @VivianHo