The Reagan administration has agreed to appoint an ambassador-level special envoy to El Salvador to help arrange elections this year in which warring political factions inside and outside the government can safely participate, according to administration and congressional sources.

They said the commitment is contained in a draft letter from Secretary of State George P. Shultz to Rep. Clarence D. Long (D-Md.), chairman of the powerful House Appropriations subcommittee on foreign operations. The subcommittee has been holding up President Reagan's request to transfer $60 million in emergency military aid for the government of El Salvador in its civil war with leftist guerrillas.

"We have a commitment for the negotiator in the draft letter" from Shultz, one congressional source said. Another source said the letter, which promises "a senior presidential envoy of ambassador level," will be delivered to the subcommittee today on the condition that Long introduce a successful motion to approve half of the transfer request, or $30 million.

The agreement with Long comes during a crucial week for the president's Central American policy, which he will defend Wednesday night in a nationally televised speech before a joint session of Congress.

His performance may well affect votes in several key committees that are considering cuts in his requests for military aid to El Salvador and further restrictions on CIA support for an armed insurgency against the leftist government of nearby Nicaragua.

House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) yesterday asked the networks to televise a Democratic response after Reagan's speech. A spokesman for O'Neill said the networks expressed interest.

In another sign of the formidable opposition the president still faces in Congress, Senate Minority Leader Robert C. Byrd (D-W.Va.) predicted yesterday that the Senate would reject Reagan's pleas for substantially increased military and economic aid to El Salvador.

"The administration is traveling down the wrong road," Byrd told a group of reporters, by seeking a government military victory rather than a negotiated settlement between combatants in El Salvador. The United States "ought to be trying to bring about a dialogue" between the Salvadoran government and the guerrillas to obtain "a political solution," he said.

Reagan upped the ante in Central America in mid-March after pessimistic assessments from key members of his administration, including U.N. Ambassador Jeane J. Kirkpatrick.

They told the president that the Salvadoran military was losing ground in its struggle against leftist insurgents who the administration says are receiving significant assistance from the Cuban-backed government of Nicaragua.

Reagan asked Congress for $110 million in additional military aid for El Salvador this fiscal year and another $85 million in fiscal 1984, which begins Oct. 1. The $110 million request included $60 million to be transferred from other foreign aid accounts.

It immediately ran into trouble in one Senate committee and was bottled up in Long's subcommittee in the House while he bargained with administration officials for commitments to appoint a special envoy to help arrange all-party elections in El Salvador, to have a legal expert review FBI investigative files on murders of U.S. citizens there and to seek judicial reforms from the Salvadoran government.

Besides winning concessions from the administration in the draft letter from Shultz, Long elicited commitments yesterday from Salvadoran President Alvaro Magana to release political prisoners and open jails to spot inspections by human rights organizations, according to congressional sources.

The agreement with Long was confirmed by an administration official who sought to play down earlier reports that Reagan would appoint "a grandiose type negotiator envisioned by those who want a power-sharing role in the region."

Long has said he wanted someone of the stature of Philip C. Habib, special envoy to the Middle East, or Sol Linowitz, who undertook a similar job for President Carter.

A congressional source said Long will settle for an ambassador-rank Latin American expert "who would have the trust of the liberal members of Congress." Several career diplomats with expertise in the region, including several former ambassadors to Latin American countries, are being discussed.

Serious negotiations between Long's staff and State Department officials resumed late last week after two weeks of deadlock over how much of the $60 million the subcommittee would release if the administration fulfilled Long's conditions.

The vote in Long's subcommittee could still be close, however. And, in the rest of Congress, Byrd suggested the momentum is running against Reagan.

"The president is going to have real trouble going over the heads of the Congress to the American people on this one," Byrd said about Reagan's televised speech Wednesday. "I don't think the American people want more boys down there or to spend more money down there."

Because the American public wants land reform in El Salvador and an end to the government death squads there, Byrd said, "I doubt" the president's speech "will have much impact on the Hill."

"We meddled in Nicaragua and we lost there," Byrd said. He added that "it seems to be pretty well accepted" that the CIA is involved with forces trying to overthrow the Nicaraguan government. He said this amounted to the CIA taking advantage of a loophole in the Boland amendment.

The amendment, named for Rep. Edward P. Boland (D-Mass.), chairman of the House Permanent Select Committee on Intelligence, forbids the CIA or Defense Department from using funds to provide assistance to anyone "for the purpose of overthrowing the government of Nicaragua . . . . "

Meanwhile, several members of Boland's committee on a CIA tour of its covert operations in Central America accepted an invitation to visit Nicaragua, the "target" of those operations.

They met in Managua with high-level officials and interviewed a Guatemalan prisoner alleged to be a CIA agent.

The Senate is scheduled to hold a secret session today at the request of Sen. Christopher J. Dodd (D-Conn.) for a briefing by intelligence committee members on U.S. covert operations in Nicaragua. Byrd said the closed session will last about 90 minutes.