US forces have been stationed at Bagram since 2001 (file image).
Four US soldiers have been killed in Afghanistan, hours after the US announced direct talks with the Taliban.
The soldiers were killed by "indirect fire" from insurgents at Bagram air base, US officials said.
Bagram, near the Afghan capital Kabul, is the largest military base for US troops in Afghanistan.
A condition for the talks, due to begin on Thursday in Qatar, was for the Taliban to renounce violence.
In comments made before the news of the attack emerged, US President Barack Obama said the announcement of talks was an "important first step toward reconciliation".
The talks are set to take place in Doha, Qatar, where the Taliban have just opened their first official overseas office.
US officials said prisoner exchanges would be one topic for discussion with the Taliban, but the first weeks would mainly be used to explore each other's agendas.
Afghan President Hamid Karzai said his government was also sending delegates to Qatar to talk to the Taliban.
Also on Tuesday, Nato handed over responsibility for security for the whole of the country to Afghan security forces.
International troops are to remain in Afghanistan until the end of 2014, providing military back-up when needed.
As well as renouncing violence, other conditions of the talks are that the Taliban break ties with al-Qaeda and respect the Afghan constitution - including the rights of women and minorities.
Talks between President Karzai's High Peace Council and the Taliban are due to follow a few days after those between the US and the Taliban, officials say.
The level of trust between the Afghan government and the Taliban is described as "low".
In the past, the Taliban have always refused to meet President Karzai or his government, dismissing them as puppets of Washington.
Masoom Stanekzai, secretary of the High Peace Council, would not give a specific date for their talks but said they would take place "within days".
US officials stressed that this was the first step on a very long road, adding that there was no guarantee of success.
After opening the "political bureau" in Doha on Tuesday alongside Qatari officials, Taliban representative Mohammed Naeem told reporters the group wanted good relations with Afghanistan's neighbours.
"We support a political and peaceful solution that ends Afghanistan's occupation, and guarantees the Islamic system and nationwide security, a Taliban statement said.
The BBC's Paul Adams in Washington says these were key statements that US officials were expecting to hear.
Pakistan, which was involved in background talks for the opening of the Taliban's Doha office, said it was "ready to continue to facilitate the process to achieve lasting peace in Afghanistan in accordance with the wishes of the Afghan people".
A US official said the militant Haqqani network would also be represented by the Taliban in Doha.
However, the senior US and Nato commander in Afghanistan, Gen Joseph Dunford, said: "All I've seen of the Haqqani would make it hard for me to believe they were reconcilable."
President Karzai has expressed anger at previous US and Qatari efforts to kick-start the peace process without properly consulting his government, reports the BBC's Bilal Sarwary from Kabul.
There is also concern within the presidential palace that the Taliban will use the office in Qatar to raise funds, adds our correspondent.
The US has never held direct talks with the Taliban, but did begin preliminary negotiations in Qatar last year. However, the Taliban suspended those talks, citing US efforts to involve the Afghan government as a key stumbling block.
In Afghanistan itself on Tuesday, a ceremony in Kabul marked the handover of responsibility for security from the Nato-led International Security Assistance Force (Isaf) to the Afghan government for the first time since the Taliban were ousted in 2001.